This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Benchmarking pallet-example #8301
Benchmarking pallet-example #8301
Changes from 9 commits
34853d2
19ff8c4
6e5902a
c4c0376
86a3333
2a3ea00
3d68f86
c436b14
3ab9102
8d2cdf9
abd4507
ef98f05
7614873
911fdcc
a291e13
612cde9
f4ff4f7
8c66979
a103aca
f28e430
a697b9a
60b614d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the documentation for
WeightForSetDummy
is outdated now.Maybe we can just remove it as we prefer to just show benchmarking way, not sure. cc @kianenigma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking it is a good way to showcasing how to set the weight: 1) thru benchmarking, 2) manually setting it via WeightForSetDummy, and it shows setting an extrinsic call as operational call.
I think it will be great showing runtime developers alternatives that they can override the measured benchmarking and tweak the weight function as they want. Will there be some scenarios that this is necessary for dev?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally what people need to understand is that pallet::weight take into argument any type which implements:
WeighData<(Arg1, Arg2, ..)>
ClassifyDispatch<(Arg1, Arg2, ..)>
PaysFee<(Arg1, Arg2, ..)>
where Arg1, Arg2, ..., are the type of the argument of the call.
Make we can keep WeightForSetDummy for this call.
I think if we keep WeightForSetDummy in the code and never use it, people can't understand how to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh boy I totally have forgotten about these manual weights.
I think they can stay, only if we mention that this is an advanced feature if you want some custom functionality. Most often, you want to use
WeightInfo
stuff only.If too much for now, @jimmychu0807 you can remove it in this PR, make a new Issue in the devhub for custom weight calculators and ping me there, I can help with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kianenigma We kind of have that in devhub here, though we should probably move it to the Transaction Weight document.
And the example implementation of WeightForSetDummy demonstrates what you could customize.
Added additional comment in code for readers to consider running benchmarking toolchain instead of manually setting weight unless they know what they are doing.