Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented May 16, 2025

Follow-on after #10884.

We don't need alloc_guard here. RawVec::from_raw_parts_in is an unsafe method, and caller guarantees that len and capacity are in legal range. We don't need to check the caller fulfilled that guarantee - that responsibility is on them.

Also clarify the safety docs for this method.

Copy link
Member Author

overlookmotel commented May 16, 2025


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 hot fixes, skip the queue and merge this PR next

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 the C-performance Category - Solution not expected to change functional behavior, only performance label May 16, 2025
@overlookmotel overlookmotel marked this pull request as ready for review May 16, 2025 12:55
@codspeed-hq
Copy link

codspeed-hq bot commented May 16, 2025

CodSpeed Instrumentation Performance Report

Merging #11073 will create unknown performance changes

Comparing 05-16-perf_allocator_vec_remove_alloc_guard_from_rawvec_from_raw_parts_in_clarify_safety_docs (7e69c08) with main (fc2f040)

Summary

🆕 36 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 codegen[checker.ts] N/A 22.3 ms N/A
🆕 codegen_sourcemap[checker.ts] N/A 68.9 ms N/A
🆕 formatter[antd.js] N/A 714.3 ms N/A
🆕 formatter[react.development.js] N/A 8.1 ms N/A
🆕 formatter[typescript.js] N/A 1.1 s N/A
🆕 isolated-declarations[vue-id.ts] N/A 57 ms N/A
🆕 lexer[RadixUIAdoptionSection.jsx] N/A 21.8 µs N/A
🆕 lexer[antd.js] N/A 24.7 ms N/A
🆕 lexer[cal.com.tsx] N/A 6 ms N/A
🆕 lexer[checker.ts] N/A 14.7 ms N/A
🆕 lexer[pdf.mjs] N/A 4 ms N/A
🆕 linter[RadixUIAdoptionSection.jsx] N/A 2.8 ms N/A
🆕 linter[cal.com.tsx] N/A 1.3 s N/A
🆕 linter[checker.ts] N/A 3.1 s N/A
🆕 mangler[antd.js] N/A 15.7 ms N/A
🆕 mangler[react.development.js] N/A 289.2 µs N/A
🆕 mangler[typescript.js] N/A 39 ms N/A
🆕 minifier[antd.js] N/A 161.2 ms N/A
🆕 minifier[react.development.js] N/A 1.8 ms N/A
🆕 minifier[typescript.js] N/A 285.6 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@overlookmotel overlookmotel force-pushed the 05-16-perf_allocator_vec_remove_alloc_guard_from_rawvec_from_raw_parts_in_clarify_safety_docs branch from cab4f00 to 51b5b12 Compare May 16, 2025 13:03
Copy link
Member

@Dunqing Dunqing left a comment

Choose a reason for hiding this comment

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

Yes, the caller must meet safety requirements; otherwise, UB is expected!

Copy link
Member Author

overlookmotel commented May 17, 2025

Merge activity

…s_in` + clarify safety docs (#11073)

Follow-on after #10884.

We don't need `alloc_guard` here. `RawVec::from_raw_parts_in` is an unsafe method, and caller guarantees that `len` and `capacity` are in legal range. We don't need to check the caller fulfilled that guarantee - that responsibility is on them.

Also clarify the safety docs for this method.
@graphite-app graphite-app bot force-pushed the 05-16-doc_allocator_vec_correct_safety_comments_for_rawvec_append_elements_ branch from 12938de to 7c84a56 Compare May 17, 2025 10:16
@graphite-app graphite-app bot force-pushed the 05-16-perf_allocator_vec_remove_alloc_guard_from_rawvec_from_raw_parts_in_clarify_safety_docs branch from 51b5b12 to 7e69c08 Compare May 17, 2025 10:17
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 17, 2025
Base automatically changed from 05-16-doc_allocator_vec_correct_safety_comments_for_rawvec_append_elements_ to main May 17, 2025 10:23
@graphite-app graphite-app bot merged commit 7e69c08 into main May 17, 2025
27 of 28 checks passed
@graphite-app graphite-app bot deleted the 05-16-perf_allocator_vec_remove_alloc_guard_from_rawvec_from_raw_parts_in_clarify_safety_docs branch May 17, 2025 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants