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

[5.0] Benchmark BLS host functions #1884

Merged
merged 12 commits into from
Nov 14, 2023
Merged

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Nov 9, 2023

Add benchmarking of BLS host functions into Leap Benchmark suites. Those host functions are directly benchmarked without using CDT wrappers.

Use benchmark/benchmark -f bls to benchmark. A sample result looks like

function                    runs        average       minimum       maximum

bls:
bls_g1_add                  1,000       2,736 ns       2,607 ns      10,048 ns
bls_g2_add                  1,000       6,766 ns       6,461 ns      13,983 ns
bls_g1_mul                  1,000     193,676 ns     191,533 ns     204,904 ns
bls_g2_mul                  1,000     486,744 ns     480,722 ns     516,755 ns
bls_pairing 1 pair          1,000   1,284,147 ns   1,263,355 ns   1,521,806 ns
bls_pairing 3 pairs         1,000   2,095,239 ns   2,060,983 ns   2,448,659 ns
bls_g1_exp 1 point          1,000     491,239 ns     485,616 ns     626,591 ns
bls_g1_exp 3 points         1,000     698,879 ns     692,786 ns     741,049 ns
bls_g2_exp 1 point          1,000   1,239,919 ns   1,229,475 ns   1,559,680 ns
bls_g2_exp 3 points         1,000   1,841,482 ns   1,821,692 ns   2,167,092 ns
bls_g1_map                  1,000     297,041 ns     291,710 ns     310,379 ns
bls_g2_map                  1,000     380,135 ns     374,088 ns     438,751 ns
bls_fp_mod                  1,000         764 ns         668 ns       7,571 ns

Resolves #1854

benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Show resolved Hide resolved
target_include_directories( benchmark PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/../unittests/include"
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to fix this now (or even when merging to main) but we should try to avoid these sort of declarations. We probably want a target similar to eosio_testing_contracts,

configure_file(contracts.hpp.in include/testing_contracts/contracts.hpp ESCAPE_QUOTES)
add_library(eosio_testing_contracts INTERFACE)
target_include_directories(eosio_testing_contracts INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/include/testing_contracts)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @spoonincode. I was doing the cleos set code issue yesterday and not getting around with this. As the PR has already merged into 5.0, for cleaner tracking, I will merge the PR to main as is, and use your suggested way later.

@arhag arhag merged commit 65cc325 into release/5.0 Nov 14, 2023
29 checks passed
@arhag arhag deleted the bls_host_funcs_benchmark branch November 14, 2023 03:44
@arhag arhag linked an issue Nov 14, 2023 that may be closed by this pull request
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.

Benchmark for leap BLS Host Functions
4 participants