Remove rt::init allocation for thread name by GnomedDev · Pull Request #123433 ·...
source link: https://github.com/rust-lang/rust/pull/123433
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Conversation
Contributor
This removes one of the allocations in a fn main() {}
program.
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
labels
Member
I'll await input from @joboet given the preceding comment, but r=me otherwise. |
Contributor
@GnomedDev Out of curiosity, what is the size of a helloworld binary after this change? |
Contributor
@bors try @rust-timer queue We can find out :) |
This comment has been minimized.
Contributor
☀️ Try build successful - checks-actions |
This comment has been minimized.
Contributor
Author
For an |
Collaborator
Finished benchmarking commit (866281d): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results CyclesResults Binary sizeResults Bootstrap: 667.94s -> 668.279s (0.05%) |
removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label
Contributor
Looks like binary size for a (size-)optimized helloworld was reduced by ~1%. |
Contributor
Author
I could change this PR to instead store an enum, do you want me to try this here or just merge this in and try as a follow-up?
|
Contributor
I'd say this more like change in |
Contributor
Author
@klensy I'm sorry, I can't understand that? Can you reword it? |
Contributor
You're changed implementation of stdlib's Thread to support that one specific use case, but degrading all others (bigger Inner size?). Probably libs members should review this. |
Contributor
Author
Inner is bigger by 8 bytes as it seems like Other than that, it would cost one extra branch during code that is accessing the thread name, which is documented to mostly be for panic handling and other diagnostics... not hot code like startup that every program has to pay for. |
Getting the name of a thread is really not on the hot path, and those 8 bytes are totally insignificant given the size of a stack. The question here is whether this added complexity is worth it. The binary size improvements seem to suggest as much, and I feel like this could improve some other things too, so I'm going to accept this. Please do use the @rustbot author |
added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
labels
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Contributor
This comment has been minimized.
Contributor
☀️ Try build successful - checks-actions |
This comment has been minimized.
Collaborator
Finished benchmarking commit (d9d26f0): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results CyclesResults Binary sizeResults Bootstrap: 670.029s -> 668.109s (-0.29%) |
removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label
Contributor
Much fewer tiny regressions in binary size. Interesting. |
Contributor
Thanks! @bors r+ |
added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
labels
Contributor
☀️ Test successful - checks-actions |
Collaborator
Finished benchmarking commit (30840c5): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results CyclesResults Binary sizeResults Bootstrap: 668.929s -> 669.502s (0.09%) |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No reviews
None yet
Successfully merging this pull request may close these issues.
None yet
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK