Repository navigation
Mark libserialize functions as inline - #53393
Conversation
commented
Aug 15, 2018
|
r? @dtolnay (rust_highfive has picked a reviewer for you, use r? to override) |
commented
Aug 15, 2018
|
Nice find. Looks good to me if the benchmarks are corroborated. |
commented
Aug 15, 2018
|
⌛ Trying commit e59ea2fc56ef72b3ac332ccd28310d0662a186c0 with merge e895c391336eabdd2ec4d9f4c94a45c94f6902b0... |
There was a problem hiding this comment.
Clearly this isn't my fault, as nobody made a lint for it!
e59ea2f to
bc900f5
Compare
commented
Aug 15, 2018
|
Rebased.
|
commented
Aug 16, 2018
|
@Mark-Simulacrum Could I get a perf run? Or are we waiting on making a dent in the queue? |
| impl< | ||
| T: Encodable | ||
| > Encodable for LinkedList<T> { | ||
| #[inline] |
There was a problem hiding this comment.
I thought #[inline] was unnecessary on generic methods?
There was a problem hiding this comment.
IIRC, ever since multiple codegen units, it can matter. I forget.
| } | ||
|
|
||
| #[inline] | ||
| pub fn read_raw_bytes(&mut self, s: &mut [u8]) -> Result<(), String> { |
There was a problem hiding this comment.
The #[inline]s on things like this and write_signed_leb128 seem definitely good, though 👍
commented
Aug 16, 2018
|
@rust-timer build e895c391336eabdd2ec4d9f4c94a45c94f6902b0 |
commented
Aug 16, 2018
|
Success: Queued e895c391336eabdd2ec4d9f4c94a45c94f6902b0 with parent 5db71db, comparison URL. |
commented
Aug 17, 2018
|
Looks like it's ready for r+ |
commented
Aug 17, 2018
|
Thanks @scottmcm, I hadn't seen that thread. @alexcrichton can you tell whether any of the downsides of |
|
@dtolnay |
commented
Aug 17, 2018
commented
Aug 17, 2018
|
Thanks, we'll remove all the ones on generic functions. r? @dtolnay |
commented
Aug 17, 2018
|
Done. I'd like to check perf again, just to be sure. |
commented
Aug 17, 2018
|
@bors try |
commented
Aug 17, 2018
|
⌛ Trying commit 1540e8c with merge 4c76652fddb127b9ed67aa60a665ab1d37f0e97f... |
commented
Aug 17, 2018
|
☀️ Test successful - status-travis |
commented
Aug 17, 2018
|
@rust-timer build 4c76652fddb127b9ed67aa60a665ab1d37f0e97f |
commented
Aug 17, 2018
|
Success: Queued 4c76652fddb127b9ed67aa60a665ab1d37f0e97f with parent f34933b, comparison URL. |
|
Ah-ha! Interesting. Looks too consistently worse to e noise. |
commented
Aug 20, 2018
|
@bors: r+ Ok I'm gonna go ahead and approve this because the functions tagged for inlining here are "obvious candidates for inlining". While it's true that not all the performance was recovered from inlining everything I think this is a good baseline to start from. I would personally prefer further analysis to figure out which functions actually need to be inlined instead of inlining all of them, which may be possible through diffing perf runs with everything inlined and without everything inlined (hottest functions at the top are likely the candidates to be inlined). I suspect you're right in that LLVM just actually needs an extra hint for some of the functions here to inline them. |
commented
Aug 20, 2018
|
📌 Commit 1540e8c has been approved by |
commented
Aug 21, 2018
|
@bors retry r- |
Got to thinking: "what if that big pile of tiny functions isn't inlining as it should?"
So a few
replace-regexlater the local perf run says this:Details
I didn't notice any increase in compile time or binary sizes for rustc/libs.