Skip to content

Inline small functions #283

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

Merged
merged 1 commit into from
Jul 21, 2021
Merged

Inline small functions #283

merged 1 commit into from
Jul 21, 2021

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Jul 21, 2021

This adds #[inline] to small functions which should be beneficial to inline.

rustc compilation performance (code size of rustc_driver up by 0.09%):

clap:check                        1.9486s   1.9416s  -0.36%
hashmap-instances:check           0.0629s   0.0626s  -0.52%
helloworld:check                  0.0443s   0.0439s  -0.69%
hyper:check                       0.3011s   0.3000s  -0.36%
regex:check                       1.1505s   1.1468s  -0.33%
syn:check                         1.6989s   1.6904s  -0.50%
syntex_syntax:check               6.8479s   6.8288s  -0.28%
winapi:check                      8.3437s   8.2967s  -0.56%

Total                            20.3979s  20.3108s  -0.43%
Summary                           4.0000s   3.9820s  -0.45%

This is the effect on compile time this has on my HashMap compile time benchmark:

hashmap-instances:check           0.0635s   0.0632s  -0.33%
hashmap-instances:release        32.0928s  32.4440s  +1.09%
hashmap-instances:debug           7.2193s   7.2800s  +0.84%

Total                            39.3756s  39.7873s  +1.05%
Summary                           1.5000s   1.5080s  +0.54%

We saw a 1.6% improvement in rustc's build time for a -20% improvement on hashmap-instances:release on rust-lang/rust#87233. So I would expect around a 0.08% regression for rustc's build time from this PR.

@Amanieu
Copy link
Member

Amanieu commented Jul 21, 2021

This looks reasonable: all of these function should compile down to approximately a single assembly instruction, so not inlining them is almost certainly a bug.

@bors r+

@bors
Copy link
Contributor

bors commented Jul 21, 2021

📌 Commit b50ecce has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Jul 21, 2021

⌛ Testing commit b50ecce with merge 47a23ab...

@bors
Copy link
Contributor

bors commented Jul 21, 2021

☀️ Test successful - checks-actions
Approved by: Amanieu
Pushing 47a23ab to master...

@bors bors merged commit 47a23ab into rust-lang:master Jul 21, 2021
@Zoxc Zoxc deleted the inline-tweaks branch July 21, 2021 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants