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

Show benchmarks comparison in PR comments #34

Merged
merged 9 commits into from
Jan 19, 2023

Conversation

piotr-roslaniec
Copy link

@piotr-roslaniec piotr-roslaniec commented Jan 10, 2023

  • Adds a comment with benchmark results rendering using GH actions
  • Requires source branch to be located at base's branch repository (so it won't work on forks, for example). Previously failed attempt: Show benchmarks comparison in PR comments #33
  • It is different from rendering implemented in the parent PR, since it shows results for any changeset directly in the PRs body (comment), instead of rendering for only a subset of changes in GH pages (changes merged to main). See Update decryption benchmarks in tpke #25.
  • I'm not sure how to avoid running benchmarks twice (once with this benchmark setup, once with the one from Update decryption benchmarks in tpke #25). For now, let's run both, and let's see if we prefer one over another.
  • Squash commits before merging
Naive random polynomial evaluation vs Arkworks implementation

lines

@github-actions
Copy link

Benchmark for 36a39b7

Click to view benchmark
Test Base PR %
SHARE COMBINE/share_combine_fast/128 47.7±0.06ms 48.1±0.05ms +0.84%
SHARE COMBINE/share_combine_fast/16 7.1±0.00ms 7.2±0.00ms +1.41%
SHARE COMBINE/share_combine_fast/32 12.8±0.00ms 12.8±0.00ms 0.00%
SHARE COMBINE/share_combine_fast/4 2.9±0.00ms 2.9±0.00ms 0.00%
SHARE COMBINE/share_combine_fast/64 24.0±0.01ms 24.1±0.01ms +0.42%
SHARE COMBINE/share_combine_fast/8 4.3±0.01ms 4.3±0.00ms 0.00%
SHARE COMBINE/share_combine_simple/128 279.3±0.08ms 279.6±0.06ms +0.11%
SHARE COMBINE/share_combine_simple/16 36.5±0.24ms 36.5±0.01ms 0.00%
SHARE COMBINE/share_combine_simple/32 69.8±0.01ms 69.9±0.01ms +0.14%
SHARE COMBINE/share_combine_simple/4 9.2±0.00ms 9.3±0.00ms +1.09%
SHARE COMBINE/share_combine_simple/64 147.0±0.02ms 147.1±0.03ms +0.07%
SHARE COMBINE/share_combine_simple/8 18.2±0.01ms 18.2±0.00ms 0.00%
SHARE CREATE/share_create_fast/128 762.5±0.45ns 774.7±30.30ns +1.60%
SHARE CREATE/share_create_fast/16 100.7±0.04ns 110.8±0.11ns +10.03%
SHARE CREATE/share_create_fast/32 142.4±0.38ns 154.6±0.09ns +8.57%
SHARE CREATE/share_create_fast/4 24.9±0.04ns 26.5±0.13ns +6.43%
SHARE CREATE/share_create_fast/64 241.9±2.32ns 249.0±0.08ns +2.94%
SHARE CREATE/share_create_fast/8 37.4±0.02ns 35.7±0.43ns -4.55%
SHARE CREATE/share_create_simple/128 272.1±0.05ms 272.3±0.40ms +0.07%
SHARE CREATE/share_create_simple/16 34.0±0.01ms 34.0±0.04ms 0.00%
SHARE CREATE/share_create_simple/32 68.0±0.01ms 68.0±0.02ms 0.00%
SHARE CREATE/share_create_simple/4 8.6±0.33ms 8.5±0.00ms -1.16%
SHARE CREATE/share_create_simple/64 136.1±0.03ms 136.1±0.21ms 0.00%
SHARE CREATE/share_create_simple/8 17.0±0.00ms 17.0±0.00ms 0.00%
SHARE PREPARE/share_prepare_fast/128 167.6±0.91ms 167.5±0.03ms -0.06%
SHARE PREPARE/share_prepare_fast/16 19.5±0.01ms 19.5±0.04ms 0.00%
SHARE PREPARE/share_prepare_fast/32 40.1±0.01ms 40.1±0.01ms 0.00%
SHARE PREPARE/share_prepare_fast/4 4.5±0.00ms 4.5±0.00ms 0.00%
SHARE PREPARE/share_prepare_fast/64 81.7±0.03ms 81.8±0.43ms +0.12%
SHARE PREPARE/share_prepare_fast/8 9.5±0.00ms 9.5±0.00ms 0.00%
SHARE PREPARE/share_prepare_simple/128 114.4±0.08ms 114.2±1.07ms -0.17%
SHARE PREPARE/share_prepare_simple/16 1595.2±17.45µs 1581.4±2.35µs -0.87%
SHARE PREPARE/share_prepare_simple/32 6.9±0.02ms 6.9±0.01ms 0.00%
SHARE PREPARE/share_prepare_simple/4 27.5±0.01µs 27.5±0.01µs 0.00%
SHARE PREPARE/share_prepare_simple/64 28.4±0.03ms 28.2±0.05ms -0.70%
SHARE PREPARE/share_prepare_simple/8 293.8±0.40µs 292.9±0.18µs -0.31%

@piotr-roslaniec piotr-roslaniec changed the base branch from sd-benchmarks to main January 17, 2023 16:21
@piotr-roslaniec piotr-roslaniec marked this pull request as ready for review January 17, 2023 16:37
@theref
Copy link

theref commented Jan 18, 2023

I'm surprised at the variance between the base and PR benchmarks. Most are negligible but we also have +10% and -4%.

Once the commits have been squashed I'm happy to merge this.

@theref
Copy link

theref commented Jan 18, 2023

@piotr-roslaniec Polynomial benchmarks aren't appearing in the PR comment. Does the comment get updated as new commits are pushed?

@piotr-roslaniec
Copy link
Author

piotr-roslaniec commented Jan 18, 2023

I'm surprised at the variance between the base and PR benchmarks. Most are negligible but we also have +10% and -4%.

This is because of the shared execution environment on GitHub Actions. It's not recommended to run performance-sensitive workloads there, but there are ways around that we could implement.

As long as it's nothing major, we can use common sense and our local environments to figure out whether the performance was actually impacted by any given change. Benchmarks in PRs could be treated as sanity checks for now (like one would use code coverage, etc.).

@piotr-roslaniec
Copy link
Author

Polynomial benchmarks aren't appearing in the PR comment. Does the comment get updated as new commits are pushed?

So far the workflow has been failing, but soon we're going to find out.

@piotr-roslaniec piotr-roslaniec force-pushed the benchmarks-pr-compare branch 2 times, most recently from e49e90a to 3faaf96 Compare January 18, 2023 18:36
@piotr-roslaniec
Copy link
Author

GitHub Actions keeps running some old commit. The current commit is:

$ git log -1 --format='%H'
3faaf967086a3d9832b191aa1068155088ba0d9c

@piotr-roslaniec
Copy link
Author

The benchmark job is failing because GH Action runs two benchmarks: one on the current commit HEAD (works) and one on the base branch (main, which fails). I fixed the issue on the base branch, so this benchmark should pass now.

@github-actions
Copy link

Benchmark for e5466b6

Click to view benchmark
Test Base PR %
ENCRYPT DECRYPT/decrypt/1024 7.8±0.09ms 7.8±0.10ms 0.00%
ENCRYPT DECRYPT/decrypt/16384 8.0±0.09ms 8.0±0.13ms 0.00%
ENCRYPT DECRYPT/decrypt/2048 8.0±0.16ms 7.9±0.13ms -1.25%
ENCRYPT DECRYPT/decrypt/256 7.9±0.09ms 7.7±0.13ms -2.53%
ENCRYPT DECRYPT/decrypt/4096 8.0±0.15ms 7.9±0.11ms -1.25%
ENCRYPT DECRYPT/decrypt/512 7.8±0.13ms 7.8±0.17ms 0.00%
ENCRYPT DECRYPT/decrypt/8192 7.9±0.09ms 7.9±0.12ms 0.00%
ENCRYPT DECRYPT/encrypt/1024 9.3±0.27ms 9.2±0.19ms -1.08%
ENCRYPT DECRYPT/encrypt/16384 9.4±0.13ms 9.4±0.22ms 0.00%
ENCRYPT DECRYPT/encrypt/2048 9.1±0.10ms 9.0±0.18ms -1.10%
ENCRYPT DECRYPT/encrypt/256 9.2±0.15ms 9.1±0.14ms -1.09%
ENCRYPT DECRYPT/encrypt/4096 9.1±0.07ms 9.2±0.11ms +1.10%
ENCRYPT DECRYPT/encrypt/512 9.1±0.09ms 9.2±0.18ms +1.10%
ENCRYPT DECRYPT/encrypt/8192 9.2±0.16ms 9.0±0.14ms -2.17%
RandomPoly/random_polynomial_ark/16 702.9±15.65ns N/A N/A
RandomPoly/random_polynomial_ark/2 113.3±1.89ns N/A N/A
RandomPoly/random_polynomial_ark/32 1287.4±12.51ns N/A N/A
RandomPoly/random_polynomial_ark/4 170.6±3.10ns N/A N/A
RandomPoly/random_polynomial_ark/64 2.4±0.06µs N/A N/A
RandomPoly/random_polynomial_ark/8 366.7±7.22ns N/A N/A
RandomPoly/random_polynomial_vec/16 648.0±9.05ns N/A N/A
RandomPoly/random_polynomial_vec/2 164.1±5.29ns N/A N/A
RandomPoly/random_polynomial_vec/32 1123.0±19.84ns N/A N/A
RandomPoly/random_polynomial_vec/4 238.5±3.91ns N/A N/A
RandomPoly/random_polynomial_vec/64 2.1±0.05µs N/A N/A
RandomPoly/random_polynomial_vec/8 367.9±3.73ns N/A N/A
SHARE COMBINE/share_combine_fast/16 9.8±0.08ms 9.8±0.22ms 0.00%
SHARE COMBINE/share_combine_fast/32 17.4±0.19ms 17.3±0.21ms -0.57%
SHARE COMBINE/share_combine_fast/4 4.0±0.10ms 4.0±0.18ms 0.00%
SHARE COMBINE/share_combine_fast/64 33.1±0.49ms 33.3±0.65ms +0.60%
SHARE COMBINE/share_combine_fast/8 6.0±0.07ms 6.0±0.11ms 0.00%
SHARE COMBINE/share_combine_simple/16 49.2±0.77ms 50.2±2.45ms +2.03%
SHARE COMBINE/share_combine_simple/32 94.9±3.39ms 92.4±1.83ms -2.63%
SHARE COMBINE/share_combine_simple/4 12.5±0.20ms 12.3±0.23ms -1.60%
SHARE COMBINE/share_combine_simple/64 199.7±6.47ms 195.0±3.49ms -2.35%
SHARE COMBINE/share_combine_simple/8 24.6±0.54ms 24.2±0.46ms -1.63%
SHARE CREATE/share_create_fast/16 138.8±1.89ns 138.7±2.05ns -0.07%
SHARE CREATE/share_create_fast/32 215.7±4.40ns 221.0±4.62ns +2.46%
SHARE CREATE/share_create_fast/4 33.2±0.51ns 34.1±1.50ns +2.71%
SHARE CREATE/share_create_fast/64 375.5±6.28ns 366.9±6.71ns -2.29%
SHARE CREATE/share_create_fast/8 48.9±0.51ns 49.0±1.24ns +0.20%
SHARE CREATE/share_create_simple/16 46.4±0.59ms 45.5±0.58ms -1.94%
SHARE CREATE/share_create_simple/32 92.2±1.38ms 91.1±1.14ms -1.19%
SHARE CREATE/share_create_simple/4 11.5±0.15ms 11.4±0.26ms -0.87%
SHARE CREATE/share_create_simple/64 186.2±3.83ms 184.0±2.15ms -1.18%
SHARE CREATE/share_create_simple/8 23.1±0.40ms 22.8±0.26ms -1.30%
SHARE PREPARE/share_prepare_fast/16 26.4±0.31ms 26.8±0.92ms +1.52%
SHARE PREPARE/share_prepare_fast/32 54.4±0.58ms 54.6±1.20ms +0.37%
SHARE PREPARE/share_prepare_fast/4 6.0±0.07ms 6.1±0.08ms +1.67%
SHARE PREPARE/share_prepare_fast/64 113.0±2.29ms 111.9±1.84ms -0.97%
SHARE PREPARE/share_prepare_fast/8 13.1±0.66ms 13.2±0.31ms +0.76%
SHARE PREPARE/share_prepare_simple/16 1826.4±26.99µs 1827.0±29.16µs +0.03%
SHARE PREPARE/share_prepare_simple/32 7.7±0.17ms 7.6±0.15ms -1.30%
SHARE PREPARE/share_prepare_simple/4 38.9±0.64µs 39.3±0.65µs +1.03%
SHARE PREPARE/share_prepare_simple/64 31.3±0.32ms 30.8±0.30ms -1.60%
SHARE PREPARE/share_prepare_simple/8 384.7±5.61µs 386.2±7.40µs +0.39%
final_exponentiation/BLS12-381 final_exponentiation/1 1614.6±66.35µs 1593.2±58.93µs -1.33%
final_exponentiation/BLS12-381 final_exponentiation/16 1611.0±75.96µs 1619.2±63.38µs +0.51%
final_exponentiation/BLS12-381 final_exponentiation/2 1639.8±131.02µs 1593.8±68.79µs -2.81%
final_exponentiation/BLS12-381 final_exponentiation/32 1611.9±76.07µs 1607.5±51.77µs -0.27%
final_exponentiation/BLS12-381 final_exponentiation/4 1609.1±93.75µs 1603.3±106.34µs -0.36%
final_exponentiation/BLS12-381 final_exponentiation/64 1618.4±62.01µs 1605.2±64.96µs -0.82%
final_exponentiation/BLS12-381 final_exponentiation/8 1613.2±81.72µs 1609.4±94.60µs -0.24%
into_affine/G1Projective 9.5±0.47µs 9.6±0.41µs +1.05%
into_affine/G2Projective 11.6±2.79µs 11.3±1.05µs -2.59%
into_projective/G1Affine 8.6±0.47ns 8.7±0.97ns +1.16%
into_projective/G2Affine 23.3±1.19ns 22.8±0.96ns -2.15%
miller_loop/BLS12-381 miller_loop/1 877.3±33.50µs 894.9±46.82µs +2.01%
miller_loop/BLS12-381 miller_loop/16 8.1±0.37ms 8.2±0.47ms +1.23%
miller_loop/BLS12-381 miller_loop/2 1375.3±99.25µs 1361.0±52.79µs -1.04%
miller_loop/BLS12-381 miller_loop/32 15.7±0.68ms 15.8±0.51ms +0.64%
miller_loop/BLS12-381 miller_loop/4 2.3±0.11ms 2.3±0.09ms 0.00%
miller_loop/BLS12-381 miller_loop/64 31.5±1.44ms 31.7±1.41ms +0.63%
miller_loop/BLS12-381 miller_loop/8 4.4±0.25ms 4.2±0.15ms -4.55%
mul/G1Affine 384.8±18.58µs 370.3±19.64µs -3.77%
mul/G1Projective 448.8±38.62µs 443.3±21.10µs -1.23%
mul/G2Affine 1141.0±47.31µs 1148.4±85.69µs +0.65%
mul/G2Projective 1366.8±46.37µs 1370.9±65.56µs +0.30%
pairing/BLS12-381 pairing 2.9±0.14ms 2.9±0.14ms 0.00%
pow/Fqk 3.1±0.15ms 3.0±0.12ms -3.23%
prepare_gx/G1Affine 6.9±0.32ns 6.9±0.35ns 0.00%
prepare_gx/G2Affine 280.6±18.80µs 279.4±14.49µs -0.43%
product_of_pairings/BLS12-381 product_of_pairings/1 2.6±0.10ms 2.6±0.06ms 0.00%
product_of_pairings/BLS12-381 product_of_pairings/16 10.0±0.25ms 9.7±0.17ms -3.00%
product_of_pairings/BLS12-381 product_of_pairings/2 3.1±0.07ms 3.0±0.04ms -3.23%
product_of_pairings/BLS12-381 product_of_pairings/32 17.5±0.23ms 17.8±0.47ms +1.71%
product_of_pairings/BLS12-381 product_of_pairings/4 4.0±0.07ms 4.0±0.09ms 0.00%
product_of_pairings/BLS12-381 product_of_pairings/64 33.6±0.81ms 32.8±0.37ms -2.38%
product_of_pairings/BLS12-381 product_of_pairings/8 6.0±0.14ms 6.0±0.13ms 0.00%
random_polynomial_evaluation/random_polynomial_ark/16 714.2±9.25ns N/A N/A
random_polynomial_evaluation/random_polynomial_ark/2 105.8±1.82ns N/A N/A
random_polynomial_evaluation/random_polynomial_ark/32 1274.9±29.56ns N/A N/A
random_polynomial_evaluation/random_polynomial_ark/4 164.6±2.77ns N/A N/A
random_polynomial_evaluation/random_polynomial_ark/64 2.4±0.02µs N/A N/A
random_polynomial_evaluation/random_polynomial_ark/8 379.2±4.34ns N/A N/A
random_polynomial_evaluation/random_polynomial_naive/16 3.5±0.02µs N/A N/A
random_polynomial_evaluation/random_polynomial_naive/2 549.9±11.76ns N/A N/A
random_polynomial_evaluation/random_polynomial_naive/32 6.6±0.08µs N/A N/A
random_polynomial_evaluation/random_polynomial_naive/4 955.6±17.91ns N/A N/A
random_polynomial_evaluation/random_polynomial_naive/64 12.9±0.13µs N/A N/A
random_polynomial_evaluation/random_polynomial_naive/8 1809.3±51.95ns N/A N/A

@piotr-roslaniec
Copy link
Author

piotr-roslaniec commented Jan 19, 2023

Those benchmarks take a lot of time to compute: They run two times in one GH action, and then once again in some other action, for 3 times total. I'm going to update and introduce some changes after merging this PR, but first I want to make sure everything works ok.

@piotr-roslaniec piotr-roslaniec merged commit 185822b into main Jan 19, 2023
@piotr-roslaniec piotr-roslaniec deleted the benchmarks-pr-compare branch January 19, 2023 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants