Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CF: ideas for next experiments



[Mark Wedel]

>    But from the other mail message, it seems that CPU issue on the
>   constant searching should not be a big deal.  Traversing the list
>   itself is pretty quick (going to the next pointer and whatever).
>   If anything, the big cost issue would be the comparisons, so if
>   searching for an item, using a method other than string comparison
>   would be hte big gain (do these point to the same thing, or are
>   these integer values the same, etc.)  Comparing a couple 20
>   character strings is probably as costly as traversing 100 objects.

I'm perhaps stating the obvious, but one of the features of the shared
string library crossfire (shstr.c) uses is that two identical strings
will always have the same address.  So you only need to compare the
pointers.

Of course, this will not help you eliminate strncmp or strstr.


Kjetil T.
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to ]