-
Notifications
You must be signed in to change notification settings - Fork 20.8k
core/types: reduce allocations in effectiveGasTip #31602
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
base: master
Are you sure you want to change the base?
core/types: reduce allocations in effectiveGasTip #31602
Conversation
NVM I have a better idea... |
|
if gasFeeCap.Cmp(baseFee) < 0 { | ||
err = ErrGasFeeCapTooLow | ||
} | ||
gasFeeCap = gasFeeCap.Sub(gasFeeCap, baseFee) | ||
gasFeeCap = new(big.Int).Sub(gasFeeCap, baseFee) |
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 would love to get rid of this allocation, but I can't
One thing to keep in mind with these optimizations, is that the There is also a PR with an alternative approach here: #31598 |
Reduces unnecessary allocations in (types.Transaction).EffectiveGasTip.
Halves the allocations, increases speed by 47%
Benchmark: