docs(lexer): update doc comment about perf benefit of reading through references#21423
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
Updates a lexer hot-path doc comment to replace outdated stdlib source links with a more current explanation of why ptr.as_ref().unwrap_unchecked() can outperform raw pointer dereferencing.
Changes:
- Removes stale links to specific
core::slice::itersource locations. - Expands the comment to explain the likely LLVM IR benefit (e.g.,
nonnull/dereferenceableon&u8) and why this can help optimize hot loops.
Merge activity
|
… references (#21423) Doc comments only change. I wrote this code 2 years ago, and had little idea then why `ptr.as_ref().unwrap_unchecked()` was so much faster than `*ptr`. The comment here was a rather half-baked explanation, likely inaccurate, and the references in the comment to stdlib's code that I made at the time are now outdated and therefore uninformative. Update the comment with a better explanation of the likely reason for the performance difference. It's still somewhat guesswork, but a more informed guess now at least.
13151e0 to
091e88e
Compare
### 💥 BREAKING CHANGES - 24fb7eb allocator: [**BREAKING**] Rename `Box` and `Vec` methods (#21395) (overlookmotel) ### 🚀 Features - ce5072d parser: Support `turbopack` magic comments (#20803) (Kane Wang) - f5deb55 napi/transform: Expose `optimizeConstEnums` and `optimizeEnums` options (#21388) (Dunqing) - 24b03de data_structures: Introduce `NonNullConst` and `NonNullMut` pointer types (#21425) (overlookmotel) ### 🐛 Bug Fixes - d7a359a ecmascript: Treat update expressions as unconditionally side-effectful (#21456) (Dunqing) - 56af2f4 transformer/async-to-generator: Correct scope of inferred named FE in async-to-generator (#21458) (Dunqing) - b3ed467 minifier: Avoid illegal `var;` when folding unused arguments copy loop (#21421) (fazba) - b0e8f13 minifier: Preserve `var` inside `catch` with same-named parameter (#21366) (Dunqing) - 4fb73a7 transformer/typescript: Preserve execution order for accessor with `useDefineForClassFields: false` (#21369) (Dunqing) ### ⚡ Performance - da3cc16 parser: Refactor out `LexerContext` (#21275) (Ulrich Stark) ### 📚 Documentation - c5b19bb allocator: Reformat comments in `Arena` (#21448) (overlookmotel) - 091e88e lexer: Update doc comment about perf benefit of reading through references (#21423) (overlookmotel) - 922cbee allocator: Remove references to "bump" from comments (#21397) (overlookmotel) Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>

Doc comments only change.
I wrote this code 2 years ago, and had little idea then why
ptr.as_ref().unwrap_unchecked()was so much faster than*ptr. The comment here was a rather half-baked explanation, likely inaccurate, and the references in the comment to stdlib's code that I made at the time are now outdated and therefore uninformative.Update the comment with a better explanation of the likely reason for the performance difference. It's still somewhat guesswork, but a more informed guess now at least.