-
Notifications
You must be signed in to change notification settings - Fork 132
*: various optimizations #4039
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
*: various optimizations #4039
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4039 +/- ##
==========================================
- Coverage 53.83% 53.76% -0.08%
==========================================
Files 242 242
Lines 39348 39412 +64
==========================================
+ Hits 21184 21190 +6
- Misses 15922 15979 +57
- Partials 2242 2243 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
app/forkjoin/forkjoin.go
Outdated
| zero O | ||
| input = make(chan I, options.inputBuf) | ||
| results = make(chan Result[I, O]) | ||
| results = make(chan Result[I, O], options.workers) |
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.
Why do we make this channel buffered? Are we sure it won't break some things down the line, as it changes its behaviour
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.
As it was explained by Claude, there was extreme goroutines contention here and this buffer resolves it. We have good test coverage for this object, so I am sure it did not break anything. However, it's hard to estimate the effect.
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.
As discussed 1:1, reverted this change.
| // Copyright © 2022-2025 Obol Labs Inc. Licensed under the terms of a Business Source License 1.1 | ||
|
|
||
| package aggsigdb | ||
|
|
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.
TBH we can revisit this memorydbV2.
Now that we have metrics of the types of feature flags operators have turned on, we can see how many have this V2 DB. I personally do not have the perspective how much it improves Charon.
I can do it as part of looking into the aggregation failures we see recently, as they are related to the DB.
|



Summary
Optimize codebase with Go 1.25 features and fix resource leaks across p2p, core, and app packages.
Key improvements:
time.Afterwithtime.NewTimer/NewTickerand proper cleanupclear()builtin for map reuse in hot pathssync.OnceFuncreplacingsync.Oncemin()/max()functions for cleaner codePackages affected:
p2p/: Timer leaks in bootnode ENR resolution and relay routercore/scheduler: Replaced busy-wait loop with channel notifications for epoch resolutioncore/aggsigdb: Eliminatedruntime.Gosched()busy-wait with buffered channelcore/parsigex: Fixed timer leak in signature exchange await logicapp/retry: Proper timer cleanup on context cancellationapp/eth2wrap: Removedtime.Sleepbusy-wait, addedclear()for map reuseapp/forkjoin: Buffered results channel for better concurrencyAll changes maintain test compatibility and pass race detection.
category: refactor
ticket: none