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

Replace eager_replace! with preinterpret! #2067

Merged
merged 4 commits into from
Feb 3, 2025

Conversation

dhedey
Copy link
Contributor

@dhedey dhedey commented Feb 1, 2025

Summary

  • Replaces the eager_replace! macro with preinterpret! - which I've rewritten from scratch and open sourced at https://github.com/dhedey/preinterpret (roughly it's a next-generation paste!)
  • Also fixes some drive-by issues I noticed (compiler warning on 1.84.0 & issues with the bash scripts after my last clean-up)

In future, we could replace all instances of paste! with preinterpret too, which would simplify quite a few macros.

Testing

Existing tests pass.

Changelog

Updated

@dhedey dhedey requested review from a team as code owners February 1, 2025 02:21
Copy link

github-actions bot commented Feb 1, 2025

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

Copy link

github-actions bot commented Feb 1, 2025

Docker tags
docker.io/radixdlt/private-scrypto-dev-container:5d8aa0525c

@dhedey dhedey changed the title Chore/replace eager with preinterpret Replace eager_replace! with preinterpret! Feb 1, 2025
Copy link

github-actions bot commented Feb 1, 2025

Benchmark for 5d8aa05

Click to view benchmark
Test Base PR %
costing::bench_prepare_wasm 44.5±0.16ms 44.7±0.08ms +0.45%
costing::decode_encoded_i8_array_to_manifest_raw_value 19.3±0.03ms 19.4±0.04ms +0.52%
costing::decode_encoded_i8_array_to_manifest_value 42.2±0.07ms 41.6±0.06ms -1.42%
costing::decode_encoded_tuple_array_to_manifest_raw_value 72.0±0.12ms 70.5±0.09ms -2.08%
costing::decode_encoded_tuple_array_to_manifest_value 104.3±0.18ms 120.5±1.02ms +15.53%
costing::decode_encoded_u8_array_to_manifest_raw_value 32.1±0.05µs 25.3±0.06µs -21.18%
costing::decode_encoded_u8_array_to_manifest_value 42.4±0.05ms 41.5±0.03ms -2.12%
costing::decode_rpd_to_manifest_raw_value 14.4±0.03µs 14.7±0.03µs +2.08%
costing::decode_rpd_to_manifest_value 11.3±0.07µs 10.9±0.05µs -3.54%
costing::deserialize_wasm 1220.8±2.85µs 1237.8±7.62µs +1.39%
costing::execute_transaction_creating_big_vec_substates 681.6±7.22ms 694.6±10.42ms +1.91%
costing::execute_transaction_reading_big_vec_substates 592.7±1.96ms 597.2±1.40ms +0.76%
costing::instantiate_flash_loan 942.1±609.23µs 1030.4±1200.86µs +9.37%
costing::instantiate_radiswap 925.2±941.22µs 1136.0±2139.02µs +22.78%
costing::scrypto_malloc 645.1±1.36ms 690.9±1.83ms +7.10%
costing::scrypto_sbor_decode 649.2±1.05ms 680.7±0.87ms +4.85%
costing::scrypto_sha256 586.1±5.76ms 602.6±1.12ms +2.82%
costing::spin_loop_v1 513.9±0.97ms 535.3±0.31ms +4.16%
costing::spin_loop_v2 594.1±2.09ms 628.7±3.32ms +5.82%
costing::validate_sbor_payload 30.0±0.06µs 29.1±0.07µs -3.00%
costing::validate_sbor_payload_bytes 250.8±1.04ns 246.0±0.46ns -1.91%
costing::validate_secp256k1 76.6±0.07µs 76.7±0.09µs +0.13%
costing::validate_wasm 33.4±0.04ms 33.6±0.08ms +0.60%
decimal::add/0 8.4±0.00ns 8.4±0.00ns 0.00%
decimal::add/rust-native 9.8±0.01ns 9.8±0.00ns 0.00%
decimal::add/wasmi 327.1±3.16ns 322.1±2.56ns -1.53%
decimal::add/wasmi-call-native 2.9±0.00µs 2.9±0.00µs 0.00%
decimal::div/0 168.4±0.57ns 168.8±0.30ns +0.24%
decimal::from_string/0 156.2±0.10ns 155.4±0.17ns -0.51%
decimal::mul/0 128.6±0.11ns 129.0±0.18ns +0.31%
decimal::mul/rust-native 128.1±0.12ns 127.3±0.15ns -0.62%
decimal::mul/wasmi 20.0±0.08µs 19.6±0.05µs -2.00%
decimal::mul/wasmi-call-native 3.0±0.01µs 3.0±0.00µs 0.00%
decimal::pow/0 661.4±0.37ns 593.8±0.41ns -10.22%
decimal::pow/rust-native 586.6±0.35ns 586.7±0.76ns +0.02%
decimal::pow/wasmi 92.1±0.43µs 93.0±0.12µs +0.98%
decimal::pow/wasmi-call-native 4.8±0.01µs 4.7±0.01µs -2.08%
decimal::root/0 8.1±0.00µs 8.1±0.03µs 0.00%
decimal::sub/0 8.1±0.00ns 8.1±0.01ns 0.00%
decimal::to_string/0 444.3±0.67ns 440.7±1.13ns -0.81%
large_transaction_processing::prepare 2.5±0.00ms 2.4±0.00ms -4.00%
large_transaction_processing::prepare_and_decompile 6.2±0.02ms 6.3±0.03ms +1.61%
large_transaction_processing::prepare_and_decompile_and_recompile 31.2±1.67ms 25.3±1.42ms -18.91%
metadata_validation::validate_urls 4.7±0.01µs 4.9±0.02µs +4.26%
precise_decimal::add/0 9.1±0.01ns 8.9±0.03ns -2.20%
precise_decimal::add/rust-native 10.9±0.04ns 10.9±0.06ns 0.00%
precise_decimal::add/wasmi 442.8±4.86ns 435.1±1.54ns -1.74%
precise_decimal::add/wasmi-call-native 3.8±0.01µs 3.8±0.01µs 0.00%
precise_decimal::div/0 293.3±1.24ns 286.4±0.42ns -2.35%
precise_decimal::from_string/0 206.1±0.29ns 204.1±0.30ns -0.97%
precise_decimal::mul/0 330.5±0.57ns 331.3±0.78ns +0.24%
precise_decimal::mul/rust-native 283.1±0.53ns 287.6±0.41ns +1.59%
precise_decimal::mul/wasmi 48.5±0.22µs 49.2±0.24µs +1.44%
precise_decimal::mul/wasmi-call-native 4.2±0.01µs 4.1±0.01µs -2.38%
precise_decimal::pow/0 1731.0±2.59ns 1757.2±1.67ns +1.51%
precise_decimal::pow/rust-native 1352.6±1.90ns 1375.0±2.86ns +1.66%
precise_decimal::pow/wasmi 231.5±1.65µs 232.5±1.31µs +0.43%
precise_decimal::pow/wasmi-call-native 7.6±0.01µs 7.5±0.01µs -1.32%
precise_decimal::root/0 58.9±0.05µs 57.3±0.04µs -2.72%
precise_decimal::sub/0 9.2±0.04ns 9.0±0.03ns -2.17%
precise_decimal::to_string/0 704.9±0.43ns 697.8±0.74ns -1.01%
schema::validate_payload 396.5±0.81µs 387.2±0.62µs -2.35%
transaction::radiswap 5.0±0.03ms 5.0±0.02ms 0.00%
transaction::transfer 1834.1±9.59µs 1815.5±8.20µs -1.01%
transaction_validation::validate_manifest 43.1±0.05µs 43.2±0.45µs +0.23%
transaction_validation::verify_bls_2KB 1002.3±6.78µs 1001.6±8.76µs -0.07%
transaction_validation::verify_bls_32B 1006.0±16.62µs 1063.6±14.43µs +5.73%
transaction_validation::verify_ecdsa 74.6±0.06µs 74.5±0.07µs -0.13%
transaction_validation::verify_ed25519 42.5±0.07µs 44.6±0.11µs +4.94%

Copy link
Member

@0xOmarA 0xOmarA 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.

Read up your README.md for the crate and it's very well written and honestly explains everything about this crate and macro very well.

@dhedey dhedey merged commit bbe05ca into develop Feb 3, 2025
33 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.

3 participants