Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
34661801
Unverified
Commit
34661801
authored
1 year ago
by
bgallois
Browse files
Options
Downloads
Patches
Plain Diff
add best practices for benchmarking
parent
4ff55d9a
No related branches found
No related tags found
No related merge requests found
Pipeline
#34438
passed
1 year ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/dev/weights-benchmarking.md
+19
-0
19 additions, 0 deletions
docs/dev/weights-benchmarking.md
with
19 additions
and
0 deletions
docs/dev/weights-benchmarking.md
+
19
−
0
View file @
34661801
...
@@ -70,3 +70,22 @@ duniter benchmark storage -d=/mnt/ssd1/duniter-v2s/t1 --chain=gdev --mul=2 --wei
...
@@ -70,3 +70,22 @@ duniter benchmark storage -d=/mnt/ssd1/duniter-v2s/t1 --chain=gdev --mul=2 --wei
4.
Copy the generated file
`paritydb_weights.rs`
in the codebase in folder
`runtime/common/src/weights/`
.
4.
Copy the generated file
`paritydb_weights.rs`
in the codebase in folder
`runtime/common/src/weights/`
.
5.
Commit changes and open an MR.
5.
Commit changes and open an MR.
## How to Write Benchmarks
### Calls
Ensure that any extrinsic call is benchmarked using the most computationally intensive path, i.e., the worst-case scenario.
### Hooks
Benchmark each hook to determine the weight consumed by it; hence, it is essential to benchmark all possible paths.
### Handlers and Internal Functions
When designing handlers and internal functions, it is advisable to avoid having them return weight for the following reasons:
1.
**Simplified Benchmarking**
: Writing benchmarks for hooks or calls where handlers and internal functions are utilized becomes more straightforward.
2.
**Reduced Benchmarking Complexity**
: By directly measuring execution and overhead in a single pass, the number of benchmarks is minimized.
3.
**Enhanced Readability**
: Understanding that weight accounting occurs at the outermost level improves the overall readability of the code.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment