-
-
Notifications
You must be signed in to change notification settings - Fork 3
Streaming Serialization Methods for Memory-Efficient Large Subtree Processing #73
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
Streaming Serialization Methods for Memory-Efficient Large Subtree Processing #73
Conversation
👋 Thanks, @freemans13!This pull request comes from a fork. For security, our CI runs in a restricted mode.
Thanks for contributing to bsv-blockchain/go-subtree! 🚀 |
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.
Woot!
mrz1836
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.
Few linter issues, see CI
Head branch was pushed to by a user without write access
mrz1836
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.
LGTM - however since this was a fork, tests and dep audit checks were not run. They will be run upon merging this branch.
|



Add Streaming Serialization Methods for Memory-Efficient Large Subtree Processing
Summary
Adds two new methods to
SubtreeDatathat enable memory-efficient streaming serialization and deserialization of transaction data. This allows applications to process very large subtrees (1M+ transactions) without loading all transactions into memory at once.Motivation
When processing large subtrees with millions of transactions, the existing
Serialize()andserializeFromReader()methods require all transactions to be in memory simultaneously. For production workloads with 1M transaction subtrees, this results in multi-GB memory usage per subtree.With multiple subtrees being processed concurrently, memory consumption becomes prohibitive, leading to OOM issues in production.
Changes
New Methods
WriteTransactionsToWriter(w io.Writer, startIdx, endIdx int) errorReadTransactionsFromReader(r io.Reader, startIdx, endIdx int) (int, error)Use Case
These methods enable a chunked processing pattern: