Skip to content

Change find to rfind starting at 0 (small optimisation)

Stewart Martin-Haugh requested to merge smh/athena:rfind0 into 23.0

Change find to rfind starting at 0 when we are searching for a pattern at the start of a string. Equivalent to C++20 starts_with

Big speedup if we use a very long string, as I have in the quick-bench example. Smaller speedup for shorter strings, but still worthwhile given how easy it is to implement Screenshot_2023-03-20_at_17.41.28

https://quick-bench.com/q/rdmzQbzAJzJcX4ZJsrcQntc10m8

Inspired by !61651 (closed)

Merge request reports

Loading