<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: [LCP]which one better?</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>&gt; which one of the following is better performance wise.</FONT>
</P>

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

<P><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Vincent Penquerc'h </FONT>
</P>

</BODY>
</HTML>