Skip to content

perf(allocator/vec): Vec::extend_desugared set len only at end #11082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: graphite-base/11082
Choose a base branch
from

Conversation

overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented May 16, 2025

Improve efficiency of Vec::extend_desugared by setting len only at the end.

std library has to set len on each turn of the loop, because it needs to drop all elements added so far in case of a panic. But our Vec<'a, T> requires that T is not Drop, so we don't have that restriction.

I'm not sure if this will make any difference. Making a PR to see what Codspeed says.

Copy link
Member Author

overlookmotel commented May 16, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


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.

@overlookmotel overlookmotel marked this pull request as ready for review May 16, 2025 15:52
@overlookmotel overlookmotel marked this pull request as draft May 16, 2025 15:52
Copy link

codspeed-hq bot commented May 16, 2025

CodSpeed Instrumentation Performance Report

Merging #11082 will not alter performance

Comparing 05-16-perf_allocator_vec_vec_extend_desugared_set_len_only_at_end (c325291) with 05-16-refactor_allocator_vec_access_len_and_cap_fields_via_getters_setters (99ad11f)

Summary

✅ 36 untouched benchmarks

@overlookmotel overlookmotel force-pushed the 05-16-perf_allocator_vec_vec_extend_desugared_set_len_only_at_end branch 2 times, most recently from 09d8ddc to 6c1f6e3 Compare May 16, 2025 17:21
@graphite-app graphite-app bot force-pushed the 05-16-refactor_allocator_vec_access_len_and_cap_fields_via_getters_setters branch from 43a935e to 0b7da6b Compare May 17, 2025 10:26
@graphite-app graphite-app bot force-pushed the 05-16-perf_allocator_vec_vec_extend_desugared_set_len_only_at_end branch from 6c1f6e3 to 52f5c1e Compare May 17, 2025 10:26
@overlookmotel overlookmotel force-pushed the 05-16-refactor_allocator_vec_access_len_and_cap_fields_via_getters_setters branch from 0b7da6b to 2798717 Compare May 17, 2025 12:05
@overlookmotel overlookmotel force-pushed the 05-16-perf_allocator_vec_vec_extend_desugared_set_len_only_at_end branch from 52f5c1e to 199504c Compare May 17, 2025 12:05
@graphite-app graphite-app bot force-pushed the 05-16-refactor_allocator_vec_access_len_and_cap_fields_via_getters_setters branch 2 times, most recently from 29d7d91 to 99ad11f Compare May 17, 2025 15:01
@graphite-app graphite-app bot force-pushed the 05-16-perf_allocator_vec_vec_extend_desugared_set_len_only_at_end branch from 199504c to c325291 Compare May 17, 2025 15:01
@overlookmotel overlookmotel changed the base branch from 05-16-refactor_allocator_vec_access_len_and_cap_fields_via_getters_setters to graphite-base/11082 May 20, 2025 20: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.

1 participant