-
Notifications
You must be signed in to change notification settings - Fork 240
chore: parallel cache de/serialization #2868
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
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
|
Claude finished @alpe's task —— View job Code Review Complete ✓I've reviewed the parallel cache serialization/deserialization changes. This is a solid performance optimization with good concurrency patterns. Here are my findings: SummaryThis PR successfully parallelizes cache I/O operations using
Issues & Recommendations🔴 Critical: Variable Shadowing in
|
Summary of ChangesHello @alpe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant performance improvements to the cache's persistence mechanisms by implementing parallel execution for both saving and loading cache data to and from disk. By concurrently handling different parts of the cache, the aim is to reduce the overall time taken for these operations, leading to a more responsive system. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces parallel execution for cache serialization and deserialization using errgroup, which should improve performance for these I/O-bound operations. The implementation is solid, including robust error handling for file operations in saveMapGob. I've made a few suggestions to improve code clarity in saveMapGob and to ensure consistency in error message formatting within LoadFromDisk.
| if err := gob.NewEncoder(writer).Encode(data); err != nil { | ||
| return fmt.Errorf("failed to encode to file %s: %w", filePath, err) | ||
| } | ||
| return nil |
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 use of if err := ... shadows the named return parameter err. While this works correctly because a return <value> statement sets the named return parameter before defer is executed, it is confusing and can be brittle. It's better to avoid shadowing the named return parameter for improved code clarity and maintainability.
if encodeErr := gob.NewEncoder(writer).Encode(data); encodeErr != nil {
err = fmt.Errorf("failed to encode to file %s: %w", filePath, encodeErr)
}
return| wg.Go(func() error { | ||
| itemsByHeightMap, err := loadMapGob[uint64, *T](filepath.Join(folderPath, itemsByHeightFilename)) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to load %s : %w", itemsByHeightFilename, err) |
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.
| wg.Go(func() error { | ||
| hashesMap, err := loadMapGob[string, bool](filepath.Join(folderPath, hashesFilename)) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to load %s : %w", hashesFilename, err) |
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.
| wg.Go(func() error { | ||
| daIncludedMap, err := loadMapGob[string, uint64](filepath.Join(folderPath, daIncludedFilename)) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to load %s : %w", daIncludedFilename, err) |
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.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2868 +/- ##
==========================================
- Coverage 64.97% 64.94% -0.04%
==========================================
Files 81 81
Lines 7250 7268 +18
==========================================
+ Hits 4711 4720 +9
- Misses 1998 2006 +8
- Partials 541 542 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* main: refactor(syncer,cache): use compare and swap loop and add comments (#2873)
* main: chore: remove extra github action yml file (#2882) fix(execution/evm): verify payload status (#2863) feat: fetch included da height from store (#2880) chore: better output on errors (#2879) refactor!: create da client and split cache interface (#2878) chore!: rename `evm-single` and `grpc-single` (#2839) build(deps): Bump golang.org/x/crypto from 0.42.0 to 0.45.0 in /tools/da-debug in the go_modules group across 1 directory (#2876) chore: parallel cache de/serialization (#2868) chore: bump blob size (#2877)
Overview
Speed up cache write/loads via parallel execution.
Pulled from #2836