[LCP]which one better?

Vincent Penquerc'h Vincent.Penquerch at artworks.co.uk
Fri May 9 19:53:01 UTC 2003


> which one of the following is better performance wise.

Depends on your libc.
Probably the isspace one: it usually is just a lookup in a boolean
table, 256 bytes, going to be quite fast as it's a short loop and
everything will be in cache after the first hit.
If using wchar_t, however, isspace might be a complex thingie
testing for different locales and considering various characters
differently depending on locale.
If you want an even faster one, you might be able to do so with
a non ASCII encoding for your characters, and be able to test for
spaceness four chars at a time (for 32 bit word size) - though it
would probably be only faster for lots of spaces at start of line.

-- 
Vincent Penquerc'h 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20030509/0772a17f/attachment.htm 


More information about the linuxCprogramming mailing list