-
Notifications
You must be signed in to change notification settings - Fork 871
go bench read + write receipts/logs for parquet vs pebble #2794
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
de009ae
feat: add ledger cache layer for receipt store
jewei1997 215a286
feat: add parquet receipt store with DuckDB range queries
jewei1997 982cf16
fix: update fakeReceiptStore.FilterLogs to new signature
jewei1997 432bd51
fix: update fakeReceiptStore.FilterLogs to new signature
jewei1997 3da7c1c
rename flushBatch to fillCache
jewei1997 3f64159
Merge branch 'main' into ledger-cache-layer
jewei1997 75dd167
go bench receipts parquet vs pebble
jewei1997 eb54490
Merge branch 'main' into ledger-cache-layer
jewei1997 6aa9c6b
fix test
jewei1997 a9dd371
make parquet its own package
jewei1997 4fe5492
Merge branch 'ledger-cache-layer' into parquet-receiptdb
jewei1997 e744ecd
fix build issue
jewei1997 9d1d18f
remove duckdb stub
jewei1997 2c364bc
remove parquet enabled
jewei1997 e807617
fix go lint
jewei1997 d6f9cdc
receipt: allow pre-marshaled bytes and expand parquet benchmarks
jewei1997 4b294d9
feat: optimize WAL write path with binary encoding and batched writes
jewei1997 69423d9
feat: add store helpers and pebble pre-marshaled bytes support
jewei1997 793dc6b
Merge branch 'parquet-receiptdb' into go-bench-receipts-unoptimized
jewei1997 6f87c37
fixes like waiting for all writes to flush
jewei1997 954f7af
fixed up parquet writing bench
jewei1997 d9b0832
add read benchmark
jewei1997 b8a5dce
increase concurrency in standalone read bench
jewei1997 fc364a2
Merge branch 'main' into go-bench-receipts-unoptimized
jewei1997 d50cf78
delete dead code
jewei1997 6318fbf
remove dead code
jewei1997 a477943
refactor
jewei1997 8ff7fdb
add bloom.go
jewei1997 01860a9
revert unnecessary changes
jewei1997 db2f5d1
Merge branch 'main' into go-bench-receipts-unoptimized
jewei1997 9babd0f
refactor
jewei1997 98a56be
Merge branch 'main' into go-bench-receipts-unoptimized
jewei1997 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| package ethbloom | ||
|
|
||
| import ( | ||
| "github.com/ethereum/go-ethereum/common" | ||
| ethtypes "github.com/ethereum/go-ethereum/core/types" | ||
| "github.com/ethereum/go-ethereum/crypto" | ||
| "github.com/ethereum/go-ethereum/eth/filters" | ||
| ) | ||
|
|
||
| var bitMasks = [8]uint8{1, 2, 4, 8, 16, 32, 64, 128} | ||
|
|
||
| // BloomIndexes represents the bit indexes inside the bloom filter that belong | ||
| // to some key. | ||
| type BloomIndexes [3]uint | ||
|
|
||
| func calcBloomIndexes(b []byte) BloomIndexes { | ||
| b = crypto.Keccak256(b) | ||
|
|
||
| var idxs BloomIndexes | ||
| for i := 0; i < len(idxs); i++ { | ||
| idxs[i] = (uint(b[2*i])<<8)&2047 + uint(b[2*i+1]) | ||
| } | ||
| return idxs | ||
| } | ||
|
|
||
| // EncodeFilters builds bloom-index slices from filter criteria. | ||
| // Result semantics: AND on outer level, OR on mid level, AND on inner level (all 3 bits). | ||
| func EncodeFilters(addresses []common.Address, topics [][]common.Hash) (res [][]BloomIndexes) { | ||
| filters := make([][][]byte, 1+len(topics)) | ||
| if len(addresses) > 0 { | ||
| filter := make([][]byte, len(addresses)) | ||
| for i, address := range addresses { | ||
| filter[i] = address.Bytes() | ||
| } | ||
| filters = append(filters, filter) | ||
| } | ||
| for _, topicList := range topics { | ||
| filter := make([][]byte, len(topicList)) | ||
| for i, topic := range topicList { | ||
| filter[i] = topic.Bytes() | ||
| } | ||
| filters = append(filters, filter) | ||
| } | ||
| for _, filter := range filters { | ||
| if len(filter) == 0 { | ||
| continue | ||
| } | ||
| bloomBits := make([]BloomIndexes, len(filter)) | ||
| for i, clause := range filter { | ||
| if clause == nil { | ||
| bloomBits = nil | ||
| break | ||
| } | ||
| bloomBits[i] = calcBloomIndexes(clause) | ||
| } | ||
| if bloomBits != nil { | ||
| res = append(res, bloomBits) | ||
| } | ||
| } | ||
| return | ||
| } | ||
|
|
||
| // MatchFilters returns true when bloom matches all filter groups. | ||
| func MatchFilters(bloom ethtypes.Bloom, filterGroups [][]BloomIndexes) bool { | ||
| for _, filter := range filterGroups { | ||
| if !matchFilter(bloom, filter) { | ||
| return false | ||
| } | ||
| } | ||
| return true | ||
| } | ||
|
|
||
| func matchFilter(bloom ethtypes.Bloom, filter []BloomIndexes) bool { | ||
| for _, possibility := range filter { | ||
| if matchBloomIndexes(bloom, possibility) { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| func matchBloomIndexes(bloom ethtypes.Bloom, idx BloomIndexes) bool { | ||
| for _, bit := range idx { | ||
| whichByte := bloom[ethtypes.BloomByteLength-1-bit/8] | ||
| mask := bitMasks[bit%8] | ||
| if whichByte&mask == 0 { | ||
| return false | ||
| } | ||
| } | ||
| return true | ||
| } | ||
|
|
||
| // MatchesCriteria checks if a log matches the filter criteria (exact match). | ||
| func MatchesCriteria(log *ethtypes.Log, crit filters.FilterCriteria) bool { | ||
| if len(crit.Addresses) > 0 { | ||
| found := false | ||
| for _, addr := range crit.Addresses { | ||
| if log.Address == addr { | ||
| found = true | ||
| break | ||
| } | ||
| } | ||
| if !found { | ||
| return false | ||
| } | ||
| } | ||
| for i, topicList := range crit.Topics { | ||
| if len(topicList) == 0 { | ||
| continue | ||
| } | ||
| if i >= len(log.Topics) { | ||
| return false | ||
| } | ||
| found := false | ||
| for _, topic := range topicList { | ||
| if log.Topics[i] == topic { | ||
| found = true | ||
| break | ||
| } | ||
| } | ||
| if !found { | ||
| return false | ||
| } | ||
| } | ||
| return true | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
just a refactor, not new code added