Skip to content

docs(lexer): update doc comment about perf benefit of reading through references#21423

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-13-docs_lexer_update_doc_comment_about_perf_benefit_of_reading_through_references
Apr 14, 2026
Merged

docs(lexer): update doc comment about perf benefit of reading through references#21423
graphite-app[bot] merged 1 commit intomainfrom
om/04-13-docs_lexer_update_doc_comment_about_perf_benefit_of_reading_through_references

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 14, 2026

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.

Copy link
Copy Markdown
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@github-actions github-actions Bot added A-parser Area - Parser C-docs Category - Documentation. Related to user-facing or internal documentation labels Apr 14, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 14, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/04-13-docs_lexer_update_doc_comment_about_perf_benefit_of_reading_through_references (13151e0) with main (4417fe3)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@overlookmotel overlookmotel self-assigned this Apr 14, 2026
@overlookmotel overlookmotel marked this pull request as ready for review April 14, 2026 12:22
Copilot AI review requested due to automatic review settings April 14, 2026 12:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::iter source locations.
  • Expands the comment to explain the likely LLVM IR benefit (e.g., nonnull/dereferenceable on &u8) and why this can help optimize hot loops.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Apr 14, 2026
Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 14, 2026

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.
@graphite-app graphite-app Bot force-pushed the om/04-13-docs_lexer_update_doc_comment_about_perf_benefit_of_reading_through_references branch from 13151e0 to 091e88e Compare April 14, 2026 12:25
@graphite-app graphite-app Bot merged commit 091e88e into main Apr 14, 2026
27 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Apr 14, 2026
@graphite-app graphite-app Bot deleted the om/04-13-docs_lexer_update_doc_comment_about_perf_benefit_of_reading_through_references branch April 14, 2026 12:30
Dunqing added a commit that referenced this pull request Apr 16, 2026
### 💥 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-docs Category - Documentation. Related to user-facing or internal documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants