On Friday, 7 October 2022 at 00:57:38 UTC, rassoc wrote:
On 10/7/22 01:39, torhu via Digitalmars-d-learn wrote:
regex is about ten times faster then.

Interesting! Using your code, I'm seeing a 1.5x max difference for ldc, nothing close to 10x. Welp, the woes of superficial benchmarking. :)

Benchmark results depend on many things, such as the actual text in both needle and haystack and the needle length. Are we dealing with unicode text by the way? One example is searching for something like "äußere" in https://www.gutenberg.org/ebooks/6343.txt.utf-8

If it's the source code, then searching for "sqlite3_value_bytes16" in the sqlite3.c file from https://www.sqlite.org/2022/sqlite-amalgamation-3390400.zip may be a good test too.

I'm getting at least 5x difference in favor of regex with LDC on these two examples.

Also are we allowed to artificially construct needle and haystack to blow up this test rather than only benchmarking it on typical real data?

Reply via email to