match() speed test
- Posted by useless_ Dec 11, 2012
- 950 views
I wrote a short test to determine the fastest way to locate substrings in a huge file. The results are unexpected. The code is at http://openeuphoria.org/pastey/175.wc , typical results are at http://openeuphoria.org/pastey/176.wc . Often, time2 is a clean sweep winner. I alternated the test order.
It's unexpected that lookng for the longer term is faster than the shorter term.
Looking for "eleven" was faster even if "x" was before "eleven", and even if i put an "e" in every needle (to attempt tripping up the search for "eleven" (the "e" would hit on every needle)).
How can this be? Is my test defective?
All that said, the speeds are very impressive: average is 260 nanoseconds per each needle!
useless