Wednesday, December 21, 2016

faster strcmp

This is a reminder about a nice technique for speeding up string comparisons. Some will call this cheating, as we'll be doing some work up front and trade space for speed; but the technique is useful in many common scenarios where most default to plain old strcmp.

libc4life provides ordered symbol tables based on binary searched sets. A symbol is simply a pointer to it's index in the set; this means it might change when more symbols are added, but the relative ordering stays the same. To speed up table generation, symbol names are const referenced instead of copied.

peace, out