Skip to content

Conversation

joshuataylor
Copy link
Contributor

I've gone through and added inline to some commonly used functions.

If everyone is happy, we could also add these to others.

We should judge what should be inlined. See https://nnethercote.github.io/perf-book/inlining.html

None. The compiler will decide itself if the function should be inlined. This will depend on the optimization level, the size of the function, etc. If you are not using link-time optimization, functions will never be inlined across crates.
#[inline]. This suggests that the function should be inlined, including across crate boundaries.

Amazingly I saw great wins with just this, as I have to call some of these functions a lot when encoding a lot of data.

This is using lto:
before

Operating System: macOS
CPU Information: Apple M1
Number of Available Cores: 8
Available memory: 16 GB
Elixir 1.13.4
Erlang 25.0.2

Benchmarking encode column ...

Name                    ips        average  deviation         median         99th %
encode columns         13.86       72.17 ms    ±21.40%       74.47 ms      114.95 ms

after:

Name                    ips        average  deviation         median         99th %
encode columns         15.12       66.13 ms    ±23.48%       68.36 ms      108.11 ms

@evnu evnu requested a review from a team July 27, 2022 11:56
@evnu
Copy link
Member

evnu commented Aug 1, 2022

@joshuataylor thanks for the PR. Can you share the code for your benchmark?

@hansihe
Copy link
Member

hansihe commented Sep 11, 2022

This looks like a very good idea to me.

@evnu
Copy link
Member

evnu commented Nov 11, 2022

Interesting. I would not expect inline to make a real difference. Can we explain why we see a difference in the performance?

@filmor filmor merged commit 05f7974 into rusterlium:master Jul 29, 2025
105 of 128 checks passed
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.

4 participants