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

[CLI] replay command: heap memory alloc dump #1637

Merged
merged 12 commits into from
Oct 27, 2023
Merged

Conversation

mstrug-rdx
Copy link
Contributor

@mstrug-rdx mstrug-rdx commented Oct 26, 2023

Summary

Added command to execute transactions from archive and dump memory allocated during execution.
Refactored InfoAlloc module to support multi-threading and moved to radix-engine-profiling project.

@github-actions
Copy link

github-actions bot commented Oct 26, 2023

Benchmark for 4f71fce

Click to view benchmark
Test Base PR %
costing::bench_prepare_wasm 77.6±0.34ms 77.0±0.45ms -0.77%
costing::decode_sbor 16.9±0.12µs 17.3±0.06µs +2.37%
costing::decode_sbor_bytes 51.4±0.13µs 47.3±0.09µs -7.98%
costing::deserialize_wasm 1405.8±7.94µs 1416.2±10.37µs +0.74%
costing::instantiate_flash_loan 4.7±0.78ms 4.8±1.03ms +2.13%
costing::instantiate_radiswap 6.8±0.08ms 6.7±0.13ms -1.47%
costing::spin_loop 26.3±0.11ms 31.2±0.14ms +18.63%
costing::validate_sbor_payload 30.9±0.15µs 32.9±0.12µs +6.47%
costing::validate_sbor_payload_bytes 375.3±0.61ns 358.3±0.54ns -4.53%
costing::validate_secp256k1 87.7±0.28µs 87.6±0.16µs -0.11%
costing::validate_wasm 43.8±0.10ms 43.2±0.12ms -1.37%
decimal::add/0 9.3±0.00ns 9.4±0.02ns +1.08%
decimal::add/rust-native 10.8±0.00ns 10.8±0.00ns 0.00%
decimal::add/wasmer 127.9±0.11ns 129.6±0.83ns +1.33%
decimal::add/wasmer-call-native 557.2±2.68ns 564.5±2.07ns +1.31%
decimal::add/wasmi 844.1±5.91ns 805.3±1.15ns -4.60%
decimal::add/wasmi-call-native 8.0±0.01µs 8.3±0.03µs +3.75%
decimal::div/0 200.6±0.93ns 200.4±0.14ns -0.10%
decimal::from_string/0 173.8±0.36ns 174.4±0.65ns +0.35%
decimal::mul/0 158.0±0.19ns 158.6±0.15ns +0.38%
decimal::mul/rust-native 153.8±0.08ns 152.2±0.34ns -1.04%
decimal::mul/wasmer 1703.7±1.40ns 1684.3±2.46ns -1.14%
decimal::mul/wasmer-call-native 722.5±1.09ns 716.4±0.63ns -0.84%
decimal::mul/wasmi 61.7±0.13µs 60.8±0.08µs -1.46%
decimal::mul/wasmi-call-native 8.2±0.02µs 8.6±0.00µs +4.88%
decimal::pow/0 733.0±1.45ns 724.5±0.83ns -1.16%
decimal::pow/rust-native 705.6±1.94ns 711.0±0.75ns +0.77%
decimal::pow/wasmer 7.4±0.02µs 7.3±0.01µs -1.35%
decimal::pow/wasmer-call-native 1182.5±1.36ns 1206.5±2.40ns +2.03%
decimal::pow/wasmi 289.2±2.87µs 289.6±0.92µs +0.14%
decimal::pow/wasmi-call-native 7.3±0.02µs 7.5±0.03µs +2.74%
decimal::root/0 9.5±0.01µs 9.5±0.03µs 0.00%
decimal::sub/0 9.4±0.01ns 9.4±0.08ns 0.00%
decimal::to_string/0 482.4±0.23ns 479.0±0.47ns -0.70%
precise_decimal::add/0 10.4±0.09ns 10.6±0.13ns +1.92%
precise_decimal::add/rust-native 12.7±0.00ns 12.7±0.00ns 0.00%
precise_decimal::add/wasmer 138.8±0.50ns 130.2±0.08ns -6.20%
precise_decimal::add/wasmer-call-native 580.8±0.62ns 582.4±0.70ns +0.28%
precise_decimal::add/wasmi 1025.7±5.10ns 1042.1±3.01ns +1.60%
precise_decimal::add/wasmi-call-native 8.8±0.03µs 8.8±0.02µs 0.00%
precise_decimal::div/0 328.6±1.53ns 331.6±0.58ns +0.91%
precise_decimal::from_string/0 223.3±0.29ns 222.8±0.36ns -0.22%
precise_decimal::mul/0 348.5±0.46ns 346.6±1.03ns -0.55%
precise_decimal::mul/rust-native 326.1±1.61ns 330.5±0.95ns +1.35%
precise_decimal::mul/wasmer 3.9±0.00µs 3.8±0.00µs -2.56%
precise_decimal::mul/wasmer-call-native 990.8±5.22ns 916.4±2.93ns -7.51%
precise_decimal::mul/wasmi 152.2±0.22µs 156.7±0.15µs +2.96%
precise_decimal::mul/wasmi-call-native 9.2±0.01µs 9.5±0.05µs +3.26%
precise_decimal::pow/0 1927.3±5.39ns 1938.8±5.33ns +0.60%
precise_decimal::pow/rust-native 1574.8±4.91ns 1591.0±4.88ns +1.03%
precise_decimal::pow/wasmer 18.1±0.00µs 18.1±0.01µs 0.00%
precise_decimal::pow/wasmer-call-native 2.4±0.01µs 2.3±0.00µs -4.17%
precise_decimal::pow/wasmi 737.9±0.81µs 741.2±0.53µs +0.45%
precise_decimal::pow/wasmi-call-native 16.5±0.04µs 17.2±0.05µs +4.24%
precise_decimal::root/0 63.6±0.06µs 64.3±0.12µs +1.10%
precise_decimal::sub/0 10.5±0.01ns 10.6±0.03ns +0.95%
precise_decimal::to_string/0 804.7±5.10ns 806.6±8.84ns +0.24%
schema::validate_payload 380.4±0.61µs 347.2±0.65µs -8.73%
transaction::radiswap 6.6±0.05ms 6.7±0.06ms +1.52%
transaction::transfer 2.1±0.00ms 2.1±0.00ms 0.00%
transaction_processing::prepare 2.9±0.01ms 2.9±0.00ms 0.00%
transaction_processing::prepare_and_decompile 7.2±0.01ms 7.3±0.19ms +1.39%
transaction_processing::prepare_and_decompile_and_recompile 27.0±0.17ms 27.2±0.16ms +0.74%
transaction_validation::validate_manifest 48.7±0.06µs 49.5±0.28µs +1.64%
transaction_validation::verify_ecdsa 85.2±0.05µs 85.1±0.11µs -0.12%
transaction_validation::verify_ed25519 60.6±0.74µs 60.2±0.29µs -0.66%

radix-engine-profiling/src/info_alloc/mod.rs Outdated Show resolved Hide resolved
val.sum_counter.store(0, Ordering::Release);
val.current_level.store(0, Ordering::Release);
val.max_level.store(0, Ordering::Release);
});
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need atomics if they're thread-local?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is a leftover from a previous implementation (when counter was shared between threads), should be fine to change to ordinary number type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed counter types, but it requires usage of ReffCell as thread local data due to needed interior mutability (atomics are implemented using UnsafeCell internally).

radix-engine-profiling/src/info_alloc/mod.rs Outdated Show resolved Hide resolved
simulator/src/replay/cmd_alloc_dump.rs Outdated Show resolved Hide resolved
@mstrug-rdx mstrug-rdx merged commit 0cae701 into develop Oct 27, 2023
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