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

Misc: clean up code #1633

Merged
merged 5 commits into from
Oct 24, 2023
Merged

Misc: clean up code #1633

merged 5 commits into from
Oct 24, 2023

Conversation

iamyulong
Copy link
Member

@iamyulong iamyulong commented Oct 24, 2023

Summary

Various code clean-ups:

  • Remove dead code
  • Apply clippy::perf lint group
    • Remove redundant clone
    • Replace expect_fun_call with unwrap_or_else
    • And others
  • Apply clippy::correctness lint group

It might worth considering other lint groups as well.

Suggested review: commit-by-commit

cargo clippy --offline --fix --allow-dirty -- --allow clippy::all --warn clippy::redundant_clone
@iamyulong iamyulong force-pushed the feature/clean-up-code branch from be165fe to 31dbc50 Compare October 24, 2023 09:58
cargo clippy --offline --fix --allow-dirty -- --allow clippy::all --warn clippy::expect_fun_call
@iamyulong iamyulong force-pushed the feature/clean-up-code branch from 31dbc50 to 792aab7 Compare October 24, 2023 09:59
cargo clippy --offline --fix --allow-dirty -- --allow clippy::all --warn clippy::perf
@github-actions
Copy link

Benchmark for 0df72ec

Click to view benchmark
Test Base PR %
costing::bench_prepare_wasm 76.0±0.36ms 75.9±0.35ms -0.13%
costing::decode_sbor 16.7±0.02µs 16.9±0.04µs +1.20%
costing::decode_sbor_bytes 46.2±0.22µs 47.3±0.22µs +2.38%
costing::deserialize_wasm 1401.7±6.45µs 1416.9±21.77µs +1.08%
costing::instantiate_flash_loan 4.4±0.71ms 4.6±0.87ms +4.55%
costing::instantiate_radiswap 6.7±0.05ms 6.6±0.10ms -1.49%
costing::spin_loop 33.8±0.40ms 26.1±0.10ms -22.78%
costing::validate_sbor_payload 30.6±0.06µs 30.9±0.25µs +0.98%
costing::validate_sbor_payload_bytes 385.6±0.94ns 385.2±6.24ns -0.10%
costing::validate_secp256k1 87.5±0.06µs 87.6±0.32µs +0.11%
costing::validate_wasm 44.7±0.10ms 43.7±0.09ms -2.24%
decimal::add/0 9.3±0.00ns 9.3±0.00ns 0.00%
decimal::add/rust-native 10.8±0.01ns 10.8±0.01ns 0.00%
decimal::add/wasmer 128.4±0.16ns 127.4±0.17ns -0.78%
decimal::add/wasmer-call-native 550.6±0.20ns 562.9±0.63ns +2.23%
decimal::add/wasmi 830.0±5.76ns 895.3±6.87ns +7.87%
decimal::add/wasmi-call-native 8.0±0.01µs 8.4±0.01µs +5.00%
decimal::div/0 200.9±0.45ns 199.9±0.23ns -0.50%
decimal::from_string/0 160.8±0.35ns 163.1±0.37ns +1.43%
decimal::mul/0 157.9±0.17ns 156.9±0.17ns -0.63%
decimal::mul/rust-native 151.7±0.30ns 150.2±0.28ns -0.99%
decimal::mul/wasmer 1674.7±2.76ns 1667.6±0.81ns -0.42%
decimal::mul/wasmer-call-native 716.1±4.47ns 714.9±0.32ns -0.17%
decimal::mul/wasmi 60.5±0.08µs 60.9±0.06µs +0.66%
decimal::mul/wasmi-call-native 8.2±0.01µs 8.6±0.01µs +4.88%
decimal::pow/0 722.9±1.32ns 725.3±0.64ns +0.33%
decimal::pow/rust-native 700.2±0.61ns 705.4±0.51ns +0.74%
decimal::pow/wasmer 7.3±0.01µs 7.3±0.00µs 0.00%
decimal::pow/wasmer-call-native 1171.9±2.73ns 1170.0±3.19ns -0.16%
decimal::pow/wasmi 283.6±0.61µs 288.4±0.72µs +1.69%
decimal::pow/wasmi-call-native 7.2±0.00µs 7.6±0.03µs +5.56%
decimal::root/0 8.8±0.01µs 9.5±0.01µs +7.95%
decimal::sub/0 9.4±0.01ns 9.4±0.01ns 0.00%
decimal::to_string/0 482.7±0.31ns 494.4±2.30ns +2.42%
precise_decimal::add/0 10.4±0.01ns 10.5±0.01ns +0.96%
precise_decimal::add/rust-native 12.7±0.04ns 12.7±0.00ns 0.00%
precise_decimal::add/wasmer 137.6±0.43ns 130.5±0.08ns -5.16%
precise_decimal::add/wasmer-call-native 581.9±0.66ns 572.1±0.87ns -1.68%
precise_decimal::add/wasmi 1033.6±5.01ns 1109.7±9.78ns +7.36%
precise_decimal::add/wasmi-call-native 8.6±0.01µs 8.9±0.01µs +3.49%
precise_decimal::div/0 328.5±1.47ns 326.6±0.47ns -0.58%
precise_decimal::from_string/0 231.4±0.24ns 225.4±0.29ns -2.59%
precise_decimal::mul/0 347.6±1.44ns 354.1±2.15ns +1.87%
precise_decimal::mul/rust-native 334.4±2.39ns 324.6±0.83ns -2.93%
precise_decimal::mul/wasmer 3.9±0.01µs 3.8±0.00µs -2.56%
precise_decimal::mul/wasmer-call-native 935.8±1.88ns 944.5±17.96ns +0.93%
precise_decimal::mul/wasmi 152.7±0.45µs 153.1±0.31µs +0.26%
precise_decimal::mul/wasmi-call-native 9.1±0.01µs 9.4±0.01µs +3.30%
precise_decimal::pow/0 2.0±0.13µs 1971.3±7.80ns -1.43%
precise_decimal::pow/rust-native 1570.5±5.91ns 1577.2±3.38ns +0.43%
precise_decimal::pow/wasmer 18.7±0.01µs 18.0±0.00µs -3.74%
precise_decimal::pow/wasmer-call-native 2.3±0.00µs 2.3±0.01µs 0.00%
precise_decimal::pow/wasmi 733.3±0.52µs 739.5±1.71µs +0.85%
precise_decimal::pow/wasmi-call-native 16.6±0.06µs 16.8±0.02µs +1.20%
precise_decimal::root/0 63.9±0.04µs 65.3±0.03µs +2.19%
precise_decimal::sub/0 10.5±0.01ns 10.5±0.00ns 0.00%
precise_decimal::to_string/0 769.7±1.18ns 793.2±4.35ns +3.05%
schema::validate_payload 347.7±2.27µs 345.9±1.49µs -0.52%
transaction::radiswap 6.4±0.06ms 6.5±0.08ms +1.56%
transaction::transfer 2.1±0.01ms 2.1±0.00ms 0.00%
transaction_processing::prepare 2.9±0.06ms 2.9±0.00ms 0.00%
transaction_processing::prepare_and_decompile 7.7±0.01ms 6.9±0.01ms -10.39%
transaction_processing::prepare_and_decompile_and_recompile 28.2±0.10ms 26.4±0.21ms -6.38%
transaction_validation::validate_manifest 48.8±0.87µs 49.0±0.02µs +0.41%
transaction_validation::verify_ecdsa 85.0±0.07µs 85.0±0.09µs 0.00%
transaction_validation::verify_ed25519 61.2±0.11µs 60.6±0.09µs -0.98%

@iamyulong iamyulong marked this pull request as ready for review October 24, 2023 10:49
@iamyulong iamyulong changed the title Feature/clean up code Misc: clean up code Oct 24, 2023
@iamyulong iamyulong merged commit ef6993d into develop Oct 24, 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