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

Protect scrypto compilation with lock file #1832

Merged
merged 43 commits into from
Jun 14, 2024

Conversation

lrubasze
Copy link
Contributor

@lrubasze lrubasze commented Jun 6, 2024

Summary

This change introduces a protection of Scrypto build artifacts with lock file.
This is important when multiple Scrypto compilation processes are invoked in parallel.
Compilation time for multiple compilations increases slightly.

Additionally:

  • produce WASM with schema file *_with_schema.wasm
  • implemented scrypto compiler cache to skip second compilation if possible
  • run RE tests with O1 optimization level. It increases the build time slightly but reduces the test time
  • reduced stack usage test duration - it is executed in the same job as Run Radix Engine tests but apparently it was rebuilding RE massively instead of reusing build artifacts from the cargo nextest run. Discovered that we need to provide exactly the same list of packages in order to benefit from incremental build.

Testing

Parallel compilation test added.

Copy link

github-actions bot commented Jun 6, 2024

Docker tags
docker.io/radixdlt/private-scrypto-builder:5e4ae1686c

Copy link

github-actions bot commented Jun 6, 2024

Benchmark for 5e4ae16

Click to view benchmark
Test Base PR %
costing::bench_prepare_wasm 66.4±0.12ms 65.6±0.15ms -1.20%
costing::decode_sbor 11.1±0.06µs 11.1±0.01µs 0.00%
costing::decode_sbor_bytes 29.1±0.01µs 29.1±0.03µs 0.00%
costing::deserialize_wasm 1288.6±2.86µs 1327.9±3.01µs +3.05%
costing::instantiate_flash_loan 3.7±0.35ms 3.9±0.56ms +5.41%
costing::instantiate_radiswap 5.7±0.04ms 5.9±0.11ms +3.51%
costing::spin_loop 21.3±0.03ms 21.4±0.05ms +0.47%
costing::validate_sbor_payload 27.8±0.05µs 26.0±0.03µs -6.47%
costing::validate_sbor_payload_bytes 236.7±0.53ns 224.6±0.60ns -5.11%
costing::validate_secp256k1 76.6±0.07µs 76.6±0.07µs 0.00%
costing::validate_wasm 36.9±0.03ms 36.6±0.05ms -0.81%
decimal::add/0 8.4±0.00ns 8.4±0.00ns 0.00%
decimal::add/rust-native 9.9±0.01ns 9.9±0.01ns 0.00%
decimal::add/wasmer 113.4±0.22ns 110.6±0.14ns -2.47%
decimal::add/wasmer-call-native 458.3±0.40ns 453.4±0.45ns -1.07%
decimal::add/wasmi 654.1±2.68ns 658.2±2.77ns +0.63%
decimal::add/wasmi-call-native 5.1±0.01µs 5.1±0.01µs 0.00%
decimal::div/0 189.9±0.16ns 190.9±0.55ns +0.53%
decimal::from_string/0 152.4±0.18ns 151.3±0.39ns -0.72%
decimal::mul/0 142.1±0.10ns 142.4±0.34ns +0.21%
decimal::mul/rust-native 138.2±0.19ns 137.1±0.14ns -0.80%
decimal::mul/wasmer 1500.7±1.10ns 1502.4±0.61ns +0.11%
decimal::mul/wasmer-call-native 581.8±0.74ns 579.7±0.44ns -0.36%
decimal::mul/wasmi 42.0±0.06µs 42.6±0.08µs +1.43%
decimal::mul/wasmi-call-native 5.2±0.01µs 5.4±0.00µs +3.85%
decimal::pow/0 653.5±0.80ns 656.5±0.32ns +0.46%
decimal::pow/rust-native 636.1±0.23ns 630.9±0.30ns -0.82%
decimal::pow/wasmer 6.6±0.00µs 6.6±0.01µs 0.00%
decimal::pow/wasmer-call-native 1038.7±4.09ns 1048.5±2.24ns +0.94%
decimal::pow/wasmi 199.0±0.47µs 201.0±0.35µs +1.01%
decimal::pow/wasmi-call-native 5.2±0.01µs 5.2±0.01µs 0.00%
decimal::root/0 7.8±0.01µs 8.0±0.01µs +2.56%
decimal::sub/0 8.5±0.01ns 8.5±0.00ns 0.00%
decimal::to_string/0 431.9±0.52ns 503.6±4.78ns +16.60%
precise_decimal::add/0 10.0±0.00ns 9.3±0.19ns -7.00%
precise_decimal::add/rust-native 11.5±0.00ns 11.5±0.00ns 0.00%
precise_decimal::add/wasmer 118.5±0.20ns 119.4±0.58ns +0.76%
precise_decimal::add/wasmer-call-native 503.2±0.53ns 502.7±0.40ns -0.10%
precise_decimal::add/wasmi 778.5±3.47ns 787.2±0.91ns +1.12%
precise_decimal::add/wasmi-call-native 6.7±0.01µs 7.3±0.02µs +8.96%
precise_decimal::div/0 301.4±0.31ns 303.5±0.12ns +0.70%
precise_decimal::from_string/0 197.5±0.20ns 196.3±0.20ns -0.61%
precise_decimal::mul/0 362.7±4.74ns 358.3±3.79ns -1.21%
precise_decimal::mul/rust-native 310.8±0.24ns 303.8±0.19ns -2.25%
precise_decimal::mul/wasmer 3.4±0.00µs 3.4±0.00µs 0.00%
precise_decimal::mul/wasmer-call-native 823.5±1.29ns 814.9±1.12ns -1.04%
precise_decimal::mul/wasmi 108.7±0.34µs 108.9±0.18µs +0.18%
precise_decimal::mul/wasmi-call-native 7.0±0.02µs 7.1±0.01µs +1.43%
precise_decimal::pow/0 1864.3±2.39ns 1862.8±7.11ns -0.08%
precise_decimal::pow/rust-native 1474.8±14.61ns 1480.7±2.86ns +0.40%
precise_decimal::pow/wasmer 16.1±0.01µs 16.1±0.01µs 0.00%
precise_decimal::pow/wasmer-call-native 2.1±0.00µs 2.1±0.00µs 0.00%
precise_decimal::pow/wasmi 525.3±0.44µs 528.7±1.14µs +0.65%
precise_decimal::pow/wasmi-call-native 13.4±0.04µs 13.3±0.11µs -0.75%
precise_decimal::root/0 57.5±0.03µs 55.9±0.12µs -2.78%
precise_decimal::sub/0 9.5±0.01ns 9.5±0.01ns 0.00%
precise_decimal::to_string/0 713.6±0.53ns 720.0±0.23ns +0.90%
schema::validate_payload 342.9±0.27µs 343.2±0.43µs +0.09%
transaction::radiswap 5.5±0.02ms 5.4±0.02ms -1.82%
transaction::transfer 1772.8±2.82µs 1778.1±3.03µs +0.30%
transaction_processing::prepare 2.2±0.00ms 2.2±0.00ms 0.00%
transaction_processing::prepare_and_decompile 6.0±0.01ms 6.1±0.02ms +1.67%
transaction_processing::prepare_and_decompile_and_recompile 24.6±1.12ms 24.5±1.29ms -0.41%
transaction_validation::validate_manifest 42.3±0.03µs 42.3±0.05µs 0.00%
transaction_validation::verify_bls_2KB 999.9±4.59µs 999.9±5.56µs 0.00%
transaction_validation::verify_bls_32B 1001.9±7.38µs 1067.8±17.92µs +6.58%
transaction_validation::verify_ecdsa 74.6±0.06µs 74.6±0.08µs 0.00%
transaction_validation::verify_ed25519 54.5±0.13µs 55.4±0.07µs +1.65%

@lrubasze lrubasze force-pushed the tweaks/scrypto_compiler_improvements branch 2 times, most recently from d71d2a5 to 8e2a10e Compare June 10, 2024 17:10
@lrubasze lrubasze force-pushed the tweaks/scrypto_compiler_improvements branch from 57d3ed4 to cc5b25a Compare June 12, 2024 07:40
Copy link
Member

@iamyulong iamyulong left a comment

Choose a reason for hiding this comment

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

Looks good!!!

radix-engine/assets/blueprints/Cargo.lock Outdated Show resolved Hide resolved
scrypto-compiler/Cargo.toml Outdated Show resolved Hide resolved
scrypto-compiler/src/lib.rs Outdated Show resolved Hide resolved
scrypto-compiler/src/lib.rs Show resolved Hide resolved
scrypto-compiler/src/lib.rs Show resolved Hide resolved
@lrubasze lrubasze merged commit e16cfd0 into develop Jun 14, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants