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

Inline StrSearcher::haystack() #42714

Merged
merged 1 commit into from
Jun 18, 2017
Merged

Inline StrSearcher::haystack() #42714

merged 1 commit into from
Jun 18, 2017

Conversation

alexbool
Copy link
Contributor

No description provided.

@alexbool
Copy link
Contributor Author

r? @BurntSushi

@BurntSushi
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 17, 2017

📌 Commit ca52d80 has been approved by BurntSushi

@BurntSushi
Copy link
Member

@bors r- (see: #42716 (comment))

@alexcrichton
Copy link
Member

Ah I feel the same as #42716, let's be sure we have numbers to justify this but otherwise let's hold off on #[inline]

@Mark-Simulacrum Mark-Simulacrum added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 17, 2017
@alexbool
Copy link
Contributor Author

@alexcrichton I discovered this by accident when inspecting assembly of one of my programs in release mode. I was surprised to find lots of calls to that function here and there when it's just a getter to the field. I thought this method is an easy catch for the optimizer to inline (provided the attribute is there), basically 2 instructions to make a call to the function and 6 instructions in the function itself become 2 mov instructions. I have neither benchmarks nor numbers. Other impls of that trait have #[inline] on this method, so I filed this PR for the sake of consistency too.

@alexcrichton
Copy link
Member

Oh don't worry, I understand how #[inline] works and how it's necessary for many small functions, and how it often can help performance quite a bit.

All I personally want is an anecdote or benchmarking showing the necessity of such tags. We have not always been so principled in the past, but it's very easy to go overboard with #[inline].

Sounds like you hit this when benchmarking, though, so sounds good to me, thanks!

@bors: r+

@bors
Copy link
Contributor

bors commented Jun 18, 2017

📌 Commit ca52d80 has been approved by alexcrichton

@Mark-Simulacrum
Copy link
Member

@bors rollup

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jun 18, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Jun 18, 2017
bors added a commit that referenced this pull request Jun 18, 2017
Rollup of 7 pull requests

- Successful merges: #42695, #42714, #42720, #42723, #42730, #42731, #42734
- Failed merges: #42722
@bors bors merged commit ca52d80 into rust-lang:master Jun 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants