{"id":22941815,"url":"https://github.com/zacksleo/substrate-node-template-benchmark","last_synced_at":"2025-04-01T21:17:37.434Z","repository":{"id":75725084,"uuid":"409940123","full_name":"zacksleo/substrate-node-template-benchmark","owner":"zacksleo","description":null,"archived":false,"fork":false,"pushed_at":"2021-09-25T15:01:33.000Z","size":48434,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T13:47:44.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zacksleo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-24T11:32:44.000Z","updated_at":"2021-09-25T15:01:36.000Z","dependencies_parsed_at":"2023-06-19T08:03:38.711Z","dependency_job_id":null,"html_url":"https://github.com/zacksleo/substrate-node-template-benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fsubstrate-node-template-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fsubstrate-node-template-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fsubstrate-node-template-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fsubstrate-node-template-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zacksleo","download_url":"https://codeload.github.com/zacksleo/substrate-node-template-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709913,"owners_count":20821298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T13:45:06.667Z","updated_at":"2025-04-01T21:17:37.417Z","avatar_url":"https://github.com/zacksleo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Substrate Node Template Benchmark\n\n\n## 编译\n\n```bash\ncargo build --release --features runtime-benchmarks\n```\n\n输出如下\n\n![](./.screenshots/build.png)\n\n## Benchmark\n\n```bash\n➜  substrate-node-template-benchmark git:(master) ✗ ./target/release/node-template benchmark --chain dev --execution=wasm --wasm-execution=compiled --pallet pallet_template --extrinsic do_something --steps 50 --repeat 20 --template=./.maintain/frame-weight-template.hbs --output=./pallets/template/src/weights.rs\n```\n\n输出如下:\n\n```text\nPallet: \"pallet_template\", Extrinsic: \"do_something\", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20\nRaw Storage Info\n========\nStorage: TemplateModule Something (r:0 w:1)\n\nMedian Slopes Analysis\n========\n-- Extrinsic Time --\n\nModel:\nTime ~=       39\n    + s        0\n              µs\n\nReads = 0 + (0 * s)\nWrites = 1 + (0 * s)\n\nMin Squares Analysis\n========\n-- Extrinsic Time --\n\nData points distribution:\n    s   mean µs  sigma µs       %\n    0      40.4       0.8    1.9%\n   20      40.2     0.871    2.1%\n   40      41.2     0.748    1.8%\n   60      38.6     0.489    1.2%\n   80      39.3     1.345    3.4%\n  100      38.5       0.5    1.2%\n  120      39.3      0.64    1.6%\n  140      38.5       0.5    1.2%\n  160      38.6     0.663    1.7%\n  180      38.6     0.489    1.2%\n  200      38.8       0.4    1.0%\n  220      38.9     0.538    1.3%\n  240      38.6     0.663    1.7%\n  260        39         0    0.0%\n  280      38.4     0.489    1.2%\n  300      39.4     0.489    1.2%\n  320      39.8       0.6    1.5%\n  340      40.9       1.3    3.1%\n  360        39     0.447    1.1%\n  380      39.4     0.663    1.6%\n  400      39.6     1.496    3.7%\n  420      41.3     0.458    1.1%\n  440      41.4     0.489    1.1%\n  460      41.9       0.3    0.7%\n  480      38.6     0.489    1.2%\n  500        39         0    0.0%\n  520      41.2       0.4    0.9%\n  540      39.8       0.4    1.0%\n  560      39.7     0.458    1.1%\n  580      39.8     0.871    2.1%\n  600      39.3     0.781    1.9%\n  620      38.5       0.5    1.2%\n  640      40.2     1.166    2.9%\n  660      38.7      0.64    1.6%\n  680      38.9       0.7    1.7%\n  700      38.4     0.489    1.2%\n  720      39.8     1.536    3.8%\n  740      39.8     1.248    3.1%\n  760      38.6     0.489    1.2%\n  780      41.4     0.489    1.1%\n  800      38.1       0.3    0.7%\n  820      39.1      0.83    2.1%\n  840      38.9       0.7    1.7%\n  860      38.5       0.5    1.2%\n  880        39         0    0.0%\n  900      38.9       0.3    0.7%\n  920      39.2     0.979    2.4%\n  940      38.9       0.7    1.7%\n  960      41.8       0.4    0.9%\n  980      41.8       0.4    0.9%\n 1000      41.2       0.4    0.9%\n\nQuality and confidence:\nparam     error\ns             0\n\nModel:\nTime ~=    39.32\n    + s        0\n              µs\n\nReads = 0 + (0 * s)\nWrites = 1 + (0 * s)\n```\n\n输出 weight.rs\n\nhttps://github.com/zacksleo/substrate-node-template-benchmark/blob/master/pallets/template/src/weights.rs\n\n```rust\n\n/// ---snip----\n\n#![cfg_attr(rustfmt, rustfmt_skip)]\n#![allow(unused_parens)]\n#![allow(unused_imports)]\n\nuse frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};\nuse sp_std::marker::PhantomData;\n\n/// Weight functions needed for pallet_template.\npub trait WeightInfo {\n\tfn do_something(s: u32, ) -\u003e Weight;\n}\n\n/// Weights for pallet_template using the Substrate node and recommended hardware.\npub struct SubstrateWeight\u003cT\u003e(PhantomData\u003cT\u003e);\nimpl\u003cT: frame_system::Config\u003e WeightInfo for SubstrateWeight\u003cT\u003e {\n\t// Storage: TemplateModule Something (r:0 w:1)\n\tfn do_something(_s: u32, ) -\u003e Weight {\n\t\t(39_329_000 as Weight)\n\t\t\t.saturating_add(T::DbWeight::get().writes(1 as Weight))\n\t}\n}\n\n// For backwards compatibility and tests\nimpl WeightInfo for () {\n\t// Storage: TemplateModule Something (r:0 w:1)\n\tfn do_something(_s: u32, ) -\u003e Weight {\n\t\t(39_329_000 as Weight)\n\t\t\t.saturating_add(RocksDbWeight::get().writes(1 as Weight))\n\t}\n}\n```\n\n## Chain Spec 生成\n\n```bash\n# Export the local chain spec to json\n./target/release/node-template build-spec --disable-default-bootnode --chain local \u003e ./.chain-spec/customSpec.json\n```\n\nchain spec raw:\n\n```bash\n./target/release/node-template build-spec --chain=./.chain-spec/customSpec.json --raw --disable-default-bootnode \u003e ./.chain-spec/customSpecRaw.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksleo%2Fsubstrate-node-template-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzacksleo%2Fsubstrate-node-template-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksleo%2Fsubstrate-node-template-benchmark/lists"}