diff options
Diffstat (limited to 'src/alf.c')
| -rw-r--r-- | src/alf.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -239,13 +239,15 @@ int match_token(int pos) { /* inline memcmp replacement of sorts. I don't think it's really faster than memcmp(), it only seems that way because there's - no function call overhead. ~20% speedup. */ + no function call overhead. ~20% speedup. + making it search backwards gives a further ~25% speedup. + */ len = t->length; - p = &input_buf[pos]; - q = t->start; + p = &input_buf[pos] + len - 1; + q = t->start + len - 1; while(len) { if(*p != *q) break; - p++; q++; + p--; q--; len--; } if(!len) return i; |
