Commits
Click on a commit to change the comparison rangeperf(parser): optimize expect() to reduce branch misprediction
Split the error handling path from the hot path in expect() and expect_without_advance() functions to improve branch prediction. The CPU can now better predict the common success path.
Changes:
- Add #[cold] #[inline(never)] handle_expect_failure() for error handling
- Refactor expect() to inline success path and separate error path
- Add #[inline] to expect_without_advance() for consistency
- Maintain same behavior while improving performance
This addresses the high branch misprediction shown by callgrind profiling.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>