Add benchmarks for Quantity operations#1477
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Go benchmarks to track performance of Quantity implementations and parsing over time (per #1467).
Changes:
- Adds benchmarks for
BigQuantityoperations:Add,Sub,Cmp - Adds benchmarks for
UInt64Quantityoperations:Add,Sub,Cmp - Adds a benchmark for
ToQuantityparsing
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @theycallmeaabie , please, resolve the conflicts 🙏 |
Signed-off-by: theycallmeaabie <[email protected]>
60657fb to
f51e47b
Compare
|
Done! |
|
@theycallmeaabie, I would like to thank you a lot for submitting this PR. We will keep issue #1467 to track other sub issues that we have in the list: #1467 (comment) We will open sub issues under #1467 for each items in the list. Could you please unlink #1467 from this PR? |
|
|
||
| func BenchmarkToQuantity(b *testing.B) { | ||
| for b.Loop() { | ||
| benchResult, _ = token.ToQuantity("0x1234567890abcdef", 64) |
There was a problem hiding this comment.
Please do not ignore errors. Assert on errors:
benchResult, err = token.ToQuantity("0x1234567890abcdef", 64)
require.NoError(t, err)
|
|
||
| func BenchmarkUInt64Quantity_Sub(b *testing.B) { | ||
| for b.Loop() { | ||
| q, _ := token.ToQuantity("1000000000", 64) |
There was a problem hiding this comment.
Please do not ignore errors. Assert on errors:
q, _ := token.ToQuantity("1000000000", 64)
require.NoError(t, err)
| for b.Loop() { | ||
| r = q.Cmp(one) | ||
| } | ||
| _ = r |
|
|
||
| func BenchmarkBigQuantity_Sub(b *testing.B) { | ||
| for b.Loop() { | ||
| q, _ := token.ToQuantity("1000000000", 128) |
There was a problem hiding this comment.
Could you please assert on errors and not ignoring it?
This comment is relevant for all other places in these methods.
|
Hi @theycallmeaabie, any news on that PR? |
|
Hi @theycallmeaabie, thanks a lot for you efforts on that PR. |
|
Hi @theycallmeaabie , I'm closing this one. If you believe you can restart the work, please, open this. Thanks for the understanding 🙏 |
Summary
BigQuantityandUInt64Quantityoperations (Add,Sub,Cmp)ToQuantityparsingResolves #1467