You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `scan` code was rather irregular, due to some quirks around when to `peek`, when to `next`, etc. I'm guessing out of a misguided desire to save perf.
The realization is that peeking 1 or 2 chars have the same perf, likewise for `next`ing 1 or 2 chars (well, in this diff, `next`ing 2 or 3 times are slightly more expensive but that's trivially fixable). Once we see that, we can just freely throw around the right amount of `peek` and `next` without needing to share some `next` code paths with some character lookahead and not with others.
Perf is actually better now! Screenshot in PR.
Also, much more readable. Previously, every time I check the `scan` code I needed to wrangle about which char I’m looking at and which char I’m looking at next, because of various imperative `next` calls here and there. No more!
0 commit comments