History log of /haiku/src/system/libroot/posix/string/strcmp.c
Revision Date Author Comments
# 39a81e5a 15-Mar-2013 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

The optimised aligned version was broken and not used.

As pointed out by Hamish the alignment used && in second case
instead of &, which meant it was never used.

Another error when a32 was 0xFF000000 and b32 was 0xFF00FFFF
would return a non zero value. A simple fix for the issues
with going over to the byte by byte comparison failed, so
rather than leave broken code I remove this for the time being.

Not the best code I've written obviously.


# ac827a2b 19-Aug-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Make strcmp do four byte comparisons on aligned strings.

Used libMicro's strcmp test to evaluate performance:
OPTS="-E -C 200 -S -W"
bin/strcmp $OPTS -N "strcmp_10" -s 10 -I 10
bin/strcmp $OPTS -N "strcmp_100" -s 100 -I 20
bin/strcmp $OPTS -N "strcmp_1k" -s 1k -I 50
bin/strcmp $OPTS -N "strcmp_10k" -s 10k -I 800
bin/strcmp $OPTS -N "strcmp_1m" -s 1m -I 500000
bin/strcmp $OPTS -N "strcmp_10m" -s 10m -I 5000000

Before:
prc thr usecs/call samples errors cnt/samp size
strcmp_10 1 1 0.02510 201 0 10000 10
strcmp_100 1 1 0.17520 169 0 5000 100
strcmp_1k 1 1 1.67700 177 0 2000 1024
strcmp_10k 1 1 17.24800 194 0 125 10240
strcmp_1m 1 1 17892.00000 160 0 1 1048576
strcmp_10m 1 1 183136.00000 201 0 1 10485760

After:
strcmp_10 1 1 0.01800 194 0 10000 10
strcmp_100 1 1 0.13540 190 0 5000 100
strcmp_1k 1 1 1.24950 188 0 2000 1024
strcmp_10k 1 1 12.85600 190 0 125 10240
strcmp_1m 1 1 12930.00000 170 0 1 1048576
strcmp_10m 1 1 134382.00000 195 0 1 10485760


# c2383f9c 19-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced our string compare functions (and memcmp()) with versions
that actually work correctly (and treat the data as unsigned
characters).
* This fixes bug #724.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24458 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5af32e75 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed src/kernel to src/system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12359 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 39a81e5ac632d3356ebd4c0b40fb24aa3228833d 15-Mar-2013 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

The optimised aligned version was broken and not used.

As pointed out by Hamish the alignment used && in second case
instead of &, which meant it was never used.

Another error when a32 was 0xFF000000 and b32 was 0xFF00FFFF
would return a non zero value. A simple fix for the issues
with going over to the byte by byte comparison failed, so
rather than leave broken code I remove this for the time being.

Not the best code I've written obviously.


# ac827a2baa5e0c486b554cdee56c72624b499a40 19-Aug-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Make strcmp do four byte comparisons on aligned strings.

Used libMicro's strcmp test to evaluate performance:
OPTS="-E -C 200 -S -W"
bin/strcmp $OPTS -N "strcmp_10" -s 10 -I 10
bin/strcmp $OPTS -N "strcmp_100" -s 100 -I 20
bin/strcmp $OPTS -N "strcmp_1k" -s 1k -I 50
bin/strcmp $OPTS -N "strcmp_10k" -s 10k -I 800
bin/strcmp $OPTS -N "strcmp_1m" -s 1m -I 500000
bin/strcmp $OPTS -N "strcmp_10m" -s 10m -I 5000000

Before:
prc thr usecs/call samples errors cnt/samp size
strcmp_10 1 1 0.02510 201 0 10000 10
strcmp_100 1 1 0.17520 169 0 5000 100
strcmp_1k 1 1 1.67700 177 0 2000 1024
strcmp_10k 1 1 17.24800 194 0 125 10240
strcmp_1m 1 1 17892.00000 160 0 1 1048576
strcmp_10m 1 1 183136.00000 201 0 1 10485760

After:
strcmp_10 1 1 0.01800 194 0 10000 10
strcmp_100 1 1 0.13540 190 0 5000 100
strcmp_1k 1 1 1.24950 188 0 2000 1024
strcmp_10k 1 1 12.85600 190 0 125 10240
strcmp_1m 1 1 12930.00000 170 0 1 1048576
strcmp_10m 1 1 134382.00000 195 0 1 10485760


# c2383f9c821495c5803a1a88360544c15cad519f 19-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced our string compare functions (and memcmp()) with versions
that actually work correctly (and treat the data as unsigned
characters).
* This fixes bug #724.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24458 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5af32e752606778be5dd7379f319fe43cb3f6b8c 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed src/kernel to src/system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12359 a95241bf-73f2-0310-859d-f6bbb57e9c96