Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
regexp: RegexpMatchEasy0_1K slower at tip #17456
What did you do?
Execute go1 benchmarks.
What did you see?
RegexpMatchEasy0_1K is much slower (at 86b2f29) as compared to 1.7.1
It did seem odd to me too initially. But
Following are the stats with
Looks like this is related to the change in how
When looking for a smallish multicharacter string (in this case, 26 characters), we used to look for the first character, then check the remaining characters, then repeat. Now we use fun SSE (AVX?) instructions to look for multiple characters at once. The new way will definitely be faster when the first character matches but the rest don't (it is not slowed down by partial matches). The old way looks like it is faster when there are few matches of the first character. I'm surprised about how much faster it is, however.
It is possible that we should do some combination algorithm, looking for just the first character and switching once we get a few false positives (partial but not complete matches).
All that said, the regexp is still doing >1GB/sec. I think this may be an instance of "something blazingly fast got a bit less blazingly fast".