-
Website
http://justin.harmonize.fm/ -
Original page
http://justin.harmonize.fm/index.php/2009/05/exploring-memcmp/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
maacl
1 comment · 2 points
-
davezor
1 comment · 1 points
-
aaronasjones
1 comment · 1 points
-
mebaran
1 comment · 1 points
-
miami web designer
1 comment · 1 points
-
-
Popular Threads
Take a look at search algorithms based on incremental approaches, for example the Boyer-Moore algorithm, for a much more efficient solution.
Running on a 328 MB haystack, 16 KB needle, using mmap for I/O, with a match at the last possible spot, on a MB Pro, the BMH algorithm found the match in 0.625 sec of real time. The naive memcmp algorithm, even with -O3 and -march=opteron, took 157 seconds!
As usual, algorithm choice is much, much more important than processor optimizations, especially when N is large.
Nice work on actually coming up with some numbers!
I'm doing. This was just a fun experiment in the impact of SIMD
instructions; I have no plans to use anything except the most naive approach
with the dumbest compiler settings for actually accomplishing my task.
That algorithm looks interesting though, and pretty much exactly what's
needed. Thanks!