Efficient STRing CoMPares?

Henry Spencer henry at zoo.toronto.edu
Thu Mar 21 03:51:06 AEST 1991


In article <1991Mar16.211154.5568 at cc.helsinki.fi> wirzenius at cc.helsinki.fi (Lars Wirzenius) writes:
>For non-portability, the fastest way would probably be to write inline
>assembly code using the machine's string compare instruction...

Actually, not necessarily so.  Even on machines which have a string-compare
instruction, that instruction is often relatively slow.  It can be quicker
to do it yourself.

There are also some fiendish tricks that can be played to considerably beat
the performance of the obvious compare loop, and of any string-compare
instruction which basically just implements that loop.  However, you'll
have to wait a bit longer to hear about them, since the summer Usenix
conference rejected my paper...
-- 
"[Some people] positively *wish* to     | Henry Spencer @ U of Toronto Zoology
believe ill of the modern world."-R.Peto|  henry at zoo.toronto.edu  utzoo!henry



More information about the Comp.lang.c mailing list