Commits
Click on a commit to change the comparison rangedocs(parser): document is_on_new_line and read_bool performance characteristics (#13867)
## Summary
This PR adds comprehensive documentation to the `is_on_new_line` and `read_bool` methods in the lexer's Token implementation, based on the performance analysis from PR #13788.
## Changes
- Document `is_on_new_line`'s purpose for ASI and JavaScript parsing rules
- Add detailed performance analysis to `read_bool` showing assembly code comparison
- Explain why unsafe pointer arithmetic is used (3 instructions vs 4 for bit operations)
- Reference PR #13788's benchmarking discussion for historical context
## Context
As discussed in #13788, the unsafe pointer arithmetic implementation was retained because it generates one fewer CPU instruction on this hot path. This documentation helps future contributors understand this design decision.
### Assembly Comparison
**Unsafe pointer arithmetic (current):**
```asm
movzx eax, BYTE PTR [rdi+9] ; 3 instructions total
and eax, 1
ret
```
**Safe bit operations (proposed but rejected):**
```asm
mov rax, QWORD PTR [rdi+8] ; 4 instructions total
shr rax, 8
and eax, 1
ret
```
🤖 Generated with [Claude Code](https://claude.ai/code)