chars: make searching case-insensitively some ten percent faster
It is quicker to do a handful of superfluous compares at the end of each line than it is to compute and keep track of and compare the remaining line length the whole time. The typical line is some sixty characters long, the typical search string ten characters -- with a shorter search string the speedup is even higher: some fifteen percent. Only when the string is longer than half the average line length does searching become slower with this new method. All this for a UTF-8 locale. For a C locale it makes no difference.
Showing
+8 -8
Please register or sign in to comment