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

POC PGO configuration #568

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

cleaton
Copy link
Contributor

@cleaton cleaton commented Oct 14, 2023

This PR adds a POC implementation to enable rustler projects to configure scripts that will be used to optimize the rust code using PGO following: https://doc.rust-lang.org/rustc/profile-guided-optimization.html#a-complete-cargo-workflow

I've only tested it on the Struct benchmark, it seems to give small but consistent (I only tried running a few times manually) improvement especially for the bigger "decode & encode" benchmark:

Benchmarking decode ...
Benchmarking decode and encode ...
# With PGO
Name                        ips        average  deviation         median         99th %
decode                   1.06 M        0.94 μs    ±49.74%        0.92 μs        1.30 μs
decode and encode        0.80 M        1.26 μs  ±1450.35%        1.20 μs        1.46 μs

Comparison: 
decode                   1.06 M
decode and encode        0.80 M - 1.33x slower +0.31 μs


# Without PGO
Name                        ips        average  deviation         median         99th %
decode                   1.04 M        0.96 μs    ±18.04%        0.95 μs        1.28 μs
decode and encode        0.76 M        1.32 μs  ±1367.14%        1.23 μs        2.17 μs

Comparison: 
decode                   1.04 M
decode and encode        0.76 M - 1.38x slower +0.36 μs

Maybe there is a bigger rustler project we could try it on.

This was first discussed in #565

@evnu evnu requested a review from a team October 16, 2023 19:07
Mix.shell().info("Configuring build for PGO profile collection")

# TODO better folder
File.rmdir("/tmp/pgo-data")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be somewhere in the build path to make that compatible with windows.

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.

None yet

2 participants