Are iterator functions amortizing vector operations when needles are close by? #184
-
Hello @BurntSushi, sorry if this is obvious but I could not find an answer on this and was not able to answer it myself by reading the source code of the lib: basically are iterator versions of the lib functions to be considered as fancy trench coats over a loop that execute memchr starting from last match onwards at each iteration? Or are they able to amortize something when next match would be in the same vector slice processed by SIMD than previous match? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
For memmem, they are definitely amortizing construction. For memchr, I believe they do as well, includes cpuid check. But I'm not sure if it's optimal. There is likely an even smarter amortization strategy (I believe some have posted about it on this repo). |
Beta Was this translation helpful? Give feedback.
For memmem, they are definitely amortizing construction.
For memchr, I believe they do as well, includes cpuid check. But I'm not sure if it's optimal. There is likely an even smarter amortization strategy (I believe some have posted about it on this repo).