From: Alex Riesen <hidden> Date: 2016-06-15 22:43:55
Johannes Schindelin, Mon, Dec 03, 2007 21:47:09 +0100:
On Mon, 3 Dec 2007, Alex Riesen wrote:
quoted
+ return c <= 32 ||
+ c == '.' ||
+ c == ',' ||
+ c == ':' ||
+ c == ';' ||
+ c == '<' ||
+ c == '>' ||
+ c == '"' ||
+ c == '\'';
Or enhance ctype.c.
That's be nice, but the "crud" conflicts with existing classification,
so I'd have to change the is*-macros as well. Don't feel like it.
I believe the code is never in hotpath anyway so the shorter the
better.
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:43:55
Hi,
On Mon, 3 Dec 2007, Alex Riesen wrote:
Johannes Schindelin, Mon, Dec 03, 2007 21:47:09 +0100:
quoted
On Mon, 3 Dec 2007, Alex Riesen wrote:
quoted
+ return c <= 32 ||
+ c == '.' ||
+ c == ',' ||
+ c == ':' ||
+ c == ';' ||
+ c == '<' ||
+ c == '>' ||
+ c == '"' ||
+ c == '\'';
Or enhance ctype.c.
That's be nice, but the "crud" conflicts with existing classification,
so I'd have to change the is*-macros as well. Don't feel like it.
I believe the code is never in hotpath anyway so the shorter the
better.
On Dec 3, 2007, at 12:19 PM, Jakub Narebski wrote:
Perhaps simplier, but isn't it slower?
Actually it's faster on modern cpu with deep pipelines. The following
is simple test on my macbookpro (repeated 3 times and picked lowest
one):
$ time ./crudtest 1000000000
old crud...
real 0m0.856s
user 0m0.839s
sys 0m0.011s
$ time ./crudtest 1000000000 simple
new crud...
real 0m0.431s
user 0m0.421s
sys 0m0.007s
Note: it's compiled with gcc -O2. -O3 gives the same timing; -O:
simple crud has the same timing while the old crud is 10x slower; -O0
(off): the simple code is 50% slower than old crud (note: 10x less
iterations):
$ time ./crudtest0 100000000
old crud...
real 0m0.659s
user 0m0.638s
sys 0m0.008s
$ time ./crudtest0 100000000 simple
new crud...
real 0m1.175s
user 0m1.149s
sys 0m0.014s
Since the default CFLAGS in git Makefile has -O2, the simple/new code
is faster by default.
__Luke