Skip to content

feat(allocator/vec2): add specialized grow_one method#9855

Merged
graphite-app[bot] merged 1 commit intomainfrom
03-18-feat_allocator_vec2_add_specialized_grow_one_method
May 3, 2025
Merged

feat(allocator/vec2): add specialized grow_one method#9855
graphite-app[bot] merged 1 commit intomainfrom
03-18-feat_allocator_vec2_add_specialized_grow_one_method

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Mar 18, 2025

A specialized version of self.reserve(len, 1) which requires the caller to ensure len == self.capacity().

Copy link
Member Author

Dunqing commented Mar 18, 2025

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 18, 2025

CodSpeed Instrumentation Performance Report

Merging #9855 will not alter performance

Comparing 03-18-feat_allocator_vec2_add_specialized_grow_one_method (7f2f247) with main (2dc4779)

Summary

✅ 36 untouched benchmarks

@Dunqing Dunqing changed the base branch from 03-13-feat_allocator_vec2_align_the_retain_method_with_the_standard_implementation to graphite-base/9855 March 18, 2025 08:30
@Dunqing Dunqing changed the base branch from graphite-base/9855 to 03-13-feat_allocator_vec2_align_the_retain_method_with_the_standard_implementation March 18, 2025 08:31
@Dunqing Dunqing changed the base branch from 03-13-feat_allocator_vec2_align_the_retain_method_with_the_standard_implementation to graphite-base/9855 March 18, 2025 08:31
@Dunqing Dunqing changed the base branch from graphite-base/9855 to 03-13-feat_allocator_vec2_align_the_retain_method_with_the_standard_implementation March 18, 2025 08:32
@Dunqing Dunqing mentioned this pull request Jan 18, 2026
12 tasks
@Dunqing Dunqing changed the base branch from 03-13-feat_allocator_vec2_align_the_retain_method_with_the_standard_implementation to graphite-base/9855 March 18, 2025 08:34
@Dunqing Dunqing changed the base branch from graphite-base/9855 to 03-13-feat_allocator_vec2_align_the_retain_method_with_the_standard_implementation March 18, 2025 08:34
@Dunqing Dunqing changed the base branch from 03-13-feat_allocator_vec2_align_the_retain_method_with_the_standard_implementation to graphite-base/9855 March 18, 2025 08:35
@Dunqing Dunqing force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from a305372 to b9a6398 Compare March 18, 2025 08:36
@Dunqing Dunqing force-pushed the graphite-base/9855 branch from 0d9b2d1 to 4465ad4 Compare March 18, 2025 08:36
@Dunqing Dunqing changed the base branch from graphite-base/9855 to 03-18-refactor_allocator_vec2_rename_parameters_and_method_name_to_align_with_std March 18, 2025 08:36
@Dunqing Dunqing force-pushed the 03-18-refactor_allocator_vec2_rename_parameters_and_method_name_to_align_with_std branch from 4465ad4 to 2fc0088 Compare March 18, 2025 08:59
@Dunqing Dunqing force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from b9a6398 to 9968328 Compare March 18, 2025 08:59
@Dunqing Dunqing marked this pull request as draft March 19, 2025 02:49
@Dunqing Dunqing force-pushed the 03-18-refactor_allocator_vec2_rename_parameters_and_method_name_to_align_with_std branch from 2fc0088 to e8c0a03 Compare March 21, 2025 08:44
@Dunqing Dunqing force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from a504121 to 10edac8 Compare April 29, 2025 13:40
@Dunqing Dunqing changed the base branch from graphite-base/9855 to 04-29-perf_allocator_vec2_calling_bump_grow_or_bump_shrink_at_the_call_site_directly April 29, 2025 13:41
@Dunqing Dunqing force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from 10edac8 to b5b57c3 Compare April 29, 2025 15:30
@Dunqing Dunqing marked this pull request as ready for review April 29, 2025 15:42
@graphite-app graphite-app bot force-pushed the 04-29-perf_allocator_vec2_calling_bump_grow_or_bump_shrink_at_the_call_site_directly branch from 58393b8 to 50aaab5 Compare April 29, 2025 16:11
@graphite-app graphite-app bot requested a review from overlookmotel as a code owner April 29, 2025 16:11
@graphite-app graphite-app bot force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from b5b57c3 to e29ab62 Compare April 29, 2025 16:12
@graphite-app graphite-app bot force-pushed the 04-29-perf_allocator_vec2_calling_bump_grow_or_bump_shrink_at_the_call_site_directly branch from 50aaab5 to cdb5487 Compare April 30, 2025 00:10
@graphite-app graphite-app bot force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from e29ab62 to 203c556 Compare April 30, 2025 00:11
@Dunqing Dunqing changed the base branch from 04-29-perf_allocator_vec2_calling_bump_grow_or_bump_shrink_at_the_call_site_directly to graphite-base/9855 April 30, 2025 02:18
@Dunqing Dunqing force-pushed the graphite-base/9855 branch from cdb5487 to c9bfd21 Compare April 30, 2025 02:30
@Dunqing Dunqing force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from 203c556 to 056efdf Compare April 30, 2025 02:30
@Dunqing Dunqing changed the base branch from graphite-base/9855 to 04-29-perf_allocator_vec2_calling_bump_grow_or_bump_shrink_at_the_call_site_directly April 30, 2025 02:30
@graphite-app graphite-app bot changed the base branch from 04-29-perf_allocator_vec2_calling_bump_grow_or_bump_shrink_at_the_call_site_directly to graphite-base/9855 May 3, 2025 13:04
@graphite-app graphite-app bot force-pushed the graphite-base/9855 branch from c9bfd21 to 2dc4779 Compare May 3, 2025 13:11
@graphite-app graphite-app bot force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from 056efdf to cbd2cdb Compare May 3, 2025 13:11
@graphite-app graphite-app bot changed the base branch from graphite-base/9855 to main May 3, 2025 13:12
@graphite-app graphite-app bot force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from cbd2cdb to 979432a Compare May 3, 2025 13:12
@coderabbitai
Copy link

coderabbitai bot commented May 3, 2025

Walkthrough

A new public method named grow_one was introduced to the RawVec struct implementation. This method is designed to increase the capacity of a RawVec by exactly one element. It requires the caller to guarantee that the current length equals the capacity. Internally, it calls the grow_amortized function to perform the memory allocation for one additional element. If an allocation error occurs, the method handles it by invoking handle_error, which aborts execution rather than returning a result. The method is annotated with #[inline(never)], indicating that it should not be inlined by the compiler. No other modifications or changes to logic or control flow were made in the codebase as part of this update.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78efa6b and 7f2f247.

📒 Files selected for processing (1)
  • crates/oxc_allocator/src/vec2/raw_vec.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/oxc_allocator/src/vec2/raw_vec.rs
⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: Conformance
  • GitHub Check: Benchmark (formatter)
  • GitHub Check: Benchmark (codegen)
  • GitHub Check: Benchmark (minifier)
  • GitHub Check: Benchmark (semantic)
  • GitHub Check: Test wasm32-wasip1-threads
  • GitHub Check: Benchmark (isolated_declarations)
  • GitHub Check: Test NAPI
  • GitHub Check: Benchmark (transformer)
  • GitHub Check: Test (macos-latest)
  • GitHub Check: Benchmark (parser)
  • GitHub Check: Test (ubuntu-latest)
  • GitHub Check: Benchmark (lexer)
  • GitHub Check: Clippy
  • GitHub Check: Miri
  • GitHub Check: Build Linter Benchmark
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label May 3, 2025
Copy link
Member

overlookmotel commented May 3, 2025

Merge activity

@overlookmotel overlookmotel force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from 979432a to 78efa6b Compare May 3, 2025 14:45
A specialized version of `self.reserve(len, 1)` which requires the caller to ensure `len == self.capacity()`.
@graphite-app graphite-app bot force-pushed the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch from 78efa6b to 7f2f247 Compare May 3, 2025 14:53
@graphite-app graphite-app bot merged commit 7f2f247 into main May 3, 2025
26 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 3, 2025
@graphite-app graphite-app bot deleted the 03-18-feat_allocator_vec2_add_specialized_grow_one_method branch May 3, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants