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

Adding the remaining "partial conversion" methods to `DatabaseKeyMapp… #1649

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

jakrawcz-rdx
Copy link
Contributor

This non-breaking, internal-only change PR adds some "missing" partial-conversion methods to the DatabaseKeyMapper (i.e. from_db_node_key(), from_db_partition_num()).

Why?

Node's new Browse API needs to list "entity addresses" (see https://radixdlt.atlassian.net/wiki/spaces/RPNV1/pages/3189211214/RNP-12+-+Browse+API+sub-API+within+Core+API#1.-Entity-Listing), which are effectively RE Node IDs, converted from DB Node keys. The Engine's mapper so far only provided the conversion for a (DB Node key, DB partition num) pair, which forced Node to use a mild-but-avoidable hack.
The exact Node TODO: https://github.com/radixdlt/babylon-node/pull/736/files#diff-148a2d8426fe568c7f0cab8adda124b9958ea5f3bc23e41c490d566bc8ffe103R279

Copy link

Benchmark for ebb4867

Click to view benchmark
Test Base PR %
costing::bench_prepare_wasm 76.8±0.35ms 76.5±0.44ms -0.39%
costing::decode_sbor 16.5±0.04µs 16.8±0.01µs +1.82%
costing::decode_sbor_bytes 51.8±0.22µs 47.4±0.28µs -8.49%
costing::deserialize_wasm 1393.4±24.27µs 1397.4±12.10µs +0.29%
costing::instantiate_flash_loan 4.2±0.17ms 4.5±0.73ms +7.14%
costing::instantiate_radiswap 6.8±0.09ms 6.7±0.05ms -1.47%
costing::spin_loop 28.9±0.05ms 26.6±0.14ms -7.96%
costing::validate_sbor_payload 30.7±0.12µs 30.3±0.12µs -1.30%
costing::validate_sbor_payload_bytes 379.1±0.99ns 374.7±0.72ns -1.16%
costing::validate_secp256k1 87.5±0.16µs 87.6±0.18µs +0.11%
costing::validate_wasm 43.9±0.07ms 43.2±0.07ms -1.59%
decimal::add/0 9.3±0.09ns 9.3±0.03ns 0.00%
decimal::add/rust-native 10.9±0.00ns 10.9±0.02ns 0.00%
decimal::add/wasmer 127.4±0.07ns 127.8±0.05ns +0.31%
decimal::add/wasmer-call-native 574.0±0.72ns 564.0±0.51ns -1.74%
decimal::add/wasmi 804.7±8.65ns 846.5±4.63ns +5.19%
decimal::add/wasmi-call-native 8.0±0.03µs 8.3±0.00µs +3.75%
decimal::div/0 201.6±0.21ns 200.0±0.52ns -0.79%
decimal::from_string/0 166.7±0.33ns 165.7±0.22ns -0.60%
decimal::mul/0 156.1±0.16ns 158.6±1.18ns +1.60%
decimal::mul/rust-native 152.0±0.11ns 150.0±0.34ns -1.32%
decimal::mul/wasmer 1676.6±0.92ns 1696.1±0.71ns +1.16%
decimal::mul/wasmer-call-native 713.9±1.27ns 705.9±1.34ns -1.12%
decimal::mul/wasmi 60.7±0.11µs 60.9±0.08µs +0.33%
decimal::mul/wasmi-call-native 8.2±0.01µs 8.4±0.01µs +2.44%
decimal::pow/0 725.1±0.77ns 734.8±1.62ns +1.34%
decimal::pow/rust-native 702.9±0.75ns 701.9±1.28ns -0.14%
decimal::pow/wasmer 7.6±0.01µs 7.3±0.01µs -3.95%
decimal::pow/wasmer-call-native 1184.6±1.21ns 1169.2±3.52ns -1.30%
decimal::pow/wasmi 285.6±0.34µs 286.6±0.61µs +0.35%
decimal::pow/wasmi-call-native 7.4±0.10µs 7.4±0.02µs 0.00%
decimal::root/0 9.7±0.02µs 8.9±0.01µs -8.25%
decimal::sub/0 9.4±0.01ns 9.4±0.01ns 0.00%
decimal::to_string/0 482.9±10.23ns 477.5±0.18ns -1.12%
precise_decimal::add/0 11.1±0.01ns 10.5±0.08ns -5.41%
precise_decimal::add/rust-native 12.7±0.00ns 12.7±0.00ns 0.00%
precise_decimal::add/wasmer 132.5±0.35ns 132.4±0.09ns -0.08%
precise_decimal::add/wasmer-call-native 580.4±0.84ns 569.9±0.51ns -1.81%
precise_decimal::add/wasmi 1021.9±4.15ns 1071.7±3.96ns +4.87%
precise_decimal::add/wasmi-call-native 8.6±0.03µs 8.8±0.01µs +2.33%
precise_decimal::div/0 325.7±0.54ns 324.6±0.34ns -0.34%
precise_decimal::from_string/0 219.1±0.30ns 219.1±0.41ns 0.00%
precise_decimal::mul/0 355.2±6.92ns 348.2±1.57ns -1.97%
precise_decimal::mul/rust-native 338.7±1.22ns 326.7±1.17ns -3.54%
precise_decimal::mul/wasmer 3.9±0.01µs 3.8±0.00µs -2.56%
precise_decimal::mul/wasmer-call-native 966.7±2.25ns 930.2±7.14ns -3.78%
precise_decimal::mul/wasmi 151.7±0.17µs 153.5±0.38µs +1.19%
precise_decimal::mul/wasmi-call-native 9.2±0.01µs 9.4±0.02µs +2.17%
precise_decimal::pow/0 1972.1±15.85ns 1964.3±9.46ns -0.40%
precise_decimal::pow/rust-native 1564.3±2.87ns 1563.5±4.60ns -0.05%
precise_decimal::pow/wasmer 18.3±0.01µs 18.5±0.01µs +1.09%
precise_decimal::pow/wasmer-call-native 2.3±0.00µs 2.3±0.00µs 0.00%
precise_decimal::pow/wasmi 742.5±1.85µs 742.9±1.73µs +0.05%
precise_decimal::pow/wasmi-call-native 16.9±0.03µs 16.9±0.05µs 0.00%
precise_decimal::root/0 64.4±2.24µs 66.1±0.02µs +2.64%
precise_decimal::sub/0 10.7±0.01ns 10.4±0.04ns -2.80%
precise_decimal::to_string/0 785.6±5.24ns 789.4±3.95ns +0.48%
schema::validate_payload 352.9±0.77µs 352.5±9.24µs -0.11%
transaction::radiswap 6.5±0.10ms 6.2±0.09ms -4.62%
transaction::transfer 2.0±0.00ms 2.0±0.00ms 0.00%
transaction_processing::prepare 2.9±0.00ms 2.8±0.01ms -3.45%
transaction_processing::prepare_and_decompile 7.0±0.01ms 7.1±0.02ms +1.43%
transaction_processing::prepare_and_decompile_and_recompile 26.5±0.11ms 26.7±0.23ms +0.75%
transaction_validation::validate_manifest 48.8±0.02µs 48.7±0.05µs -0.20%
transaction_validation::verify_ecdsa 85.2±0.99µs 85.1±0.07µs -0.12%
transaction_validation::verify_ed25519 60.8±0.05µs 61.1±0.08µs +0.49%

@jakrawcz-rdx
Copy link
Contributor Author

Since the change is so low-risk, let me merge this backed by just 1x LGTM :)

@jakrawcz-rdx jakrawcz-rdx merged commit 3120a0c into develop Nov 13, 2023
23 of 25 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