perf: optimize state machine for better branch prediction
Analyzed assembly output and implemented several optimizations to improve
branch prediction and reduce instruction count in hot paths:
1. **Explicit enum discriminants**: Added explicit u8 discriminants (0-6)
to State enum for more efficient comparisons
2. **Integer-based state matching**: Changed from enum pattern matching to
integer discriminant matching with unreachable_unchecked hint for
impossible cases
3. **Fast-path optimization**: Added early-return fast paths in top() and
in_string() functions for the most common case (non-special characters)
Performance improvements (measured with criterion):
- tsconfig: 3.5-4.7% faster (2.219µs → 2.129µs)
- no_comments: 4.5-5.4% faster (472ns → 451ns)
- minimal_comments: 6.3-8.2% faster (121ns → 112ns)
- large_with_comments: 2.5-3.6% faster (11.375µs → 11.109µs)
All tests pass. Assembly analysis shows simpler integer comparisons and
better instruction cache locality with more predictable branching.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>