-
Notifications
You must be signed in to change notification settings - Fork 26
Remove Log slices to pointers, use Sonic #178
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
Conversation
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.
Pull Request Overview
This PR makes minor improvements by replacing the use of the standard JSON package with sonic’s default configuration and converting log slices from pointers ( []*types.Log ) to value types ( []types.Log ) where appropriate.
- Replace standard json marshaling/unmarshaling with sonic’s ConfigDefault variants across multiple files.
- Update signatures and implementations to use value types for logs, reducing unnecessary pointer usage.
Reviewed Changes
Copilot reviewed 70 out of 70 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ethrpc/ethrpc.go | Updated JSON operations to use sonic and added sonic import. |
| ethrpc/batch.go | Replaced json marshalling with sonic marshalling. |
| ethreceipts/receipt.go | Changed logs field and related methods from pointer slices to value slices. |
| ethreceipts/filterer.go | Updated filter functions to use value slices for logs. |
| ethreceipts/ethreceipts.go | Updated log group and count logic; replaced pointer log handling with value-based handling. |
| ethmonitor/* & others | Replaced json usage with sonic across various components. |
| etcoder/, ethartifact/, cmd/* | Adopted sonic for JSON operations and updated log handling where applicable. |
Comments suppressed due to low confidence (1)
ethreceipts/ethreceipts.go:948
- The function 'max' is referenced here but is not defined or imported. Consider replacing it with a defined max operation, for example using a custom utility function or an inline comparison.
blockCount = max(blockCount, log.TxIndex+1)
pkieltyka
left a comment
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.
can you switch to sonic.ConfigFastest instead of sonic.ConfigDefault
| // Find specific meta transaction -- note: this is not the "transaction hash", | ||
| // this is a sub-transaction where the id is emitted as an event. | ||
| FilterMetaTransactionID := func(metaTxnID ethkit.Hash) ethreceipts.FilterQuery { | ||
| return ethreceipts.FilterLogs(func(logs []*types.Log) bool { |
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.
can you write a little benchmark separately to see what the performance effects are of doing this..? I'm curious if this will save us memory in practice..?
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.
After writing a benchmark neither pointer removal or sonic help with performance.
|
After some benchmarking this changes don't bring any improvement in performance. Closing it in favor of #179 which contains the salvageable parts of this PR. |
Uh oh!
There was an error while loading. Please reload this page.