Skip to content
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

optimize dynamic allocation alignment #17092

Closed
thestinger opened this issue Sep 8, 2014 · 2 comments
Closed

optimize dynamic allocation alignment #17092

thestinger opened this issue Sep 8, 2014 · 2 comments
Assignees
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@thestinger
Copy link
Contributor

The non-jemalloc allocator implementation should branch on the Rust end in order to use malloc / realloc / free. It will optimize out in essentially every real-world case, since alignment is rarely dynamic.

Exposing functions without the alignment parameter may also make sense, and having a branch on the Rust side for jemalloc would eliminate a branch for the low alignment case inside the allocator.

@thestinger thestinger added the I-slow Issue: Problems and improvements with respect to performance of generated code. label Sep 8, 2014
@thestinger thestinger self-assigned this Sep 8, 2014
@thestinger thestinger changed the title optimize dynamic allocation alignment optimize dynamic allocation alignment for the non-jemalloc case Sep 8, 2014
@huonw
Copy link
Member

huonw commented Sep 8, 2014

Does this apply to the size also?

@thestinger thestinger changed the title optimize dynamic allocation alignment for the non-jemalloc case optimize dynamic allocation alignment Sep 8, 2014
@thestinger
Copy link
Contributor Author

@huonw: It's just an issue for non-standard alignment, since jemalloc needs to do a branch to support it. For a --disable-jemalloc build, a non-standard alignment is a bigger problem. It's just a small micro-optimization, but I happen to be looking into micro-optimizing allocation right now so every little thing counts. In theory, Rust could also do the size calculation statically and have a non-standard hole in the jemalloc API... but we can get to that kind of thing later.

bors added a commit that referenced this issue Sep 10, 2014
Previously, some parts of this optimization were impossible because the
alignment passed to the free function was not correct. That was fully
fixed by #17012.

Closes #17092
lnicola pushed a commit to lnicola/rust that referenced this issue Apr 20, 2024
minor: Update `per_query_memory_usage` query listing
lnicola pushed a commit to lnicola/rust that referenced this issue Apr 20, 2024
minor: Update `per_query_memory_usage` query listing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants