hiero-ledger / hiero-ledger/hiero-consensus-node
Optimize memory allocations with block stream production
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
### Background
During a performance test run, a jfr profile is showing high memory allocations for the production/writing of the block stream.
There are two places where this is happening. One is where we are writing block items to disk and one in the ParalellTask execute method, where we write the item into the message digest.
We should look into if we can reuse WritableMessageDigest in the parallel task.
### Acceptance Criteria
1. Get a profile after improvements are made
2. Avoid calling toByteArray if possible
3. Avoid calling BlockItem.PROTOBUF.toBytes if possible
### Dependencies
_No response_
### Definition of Ready (DoR) Checklist
- [ ] Clear acceptance criteria
- [ ] Clear and detailed description
- [ ] Dependencies identified
- [ ] Links to documentation
- [ ] Should be completable in 2-3 Days
- [ ] Initial draft of Low-level design document
- [ ] At least high level test plan
- [ ] Groomed/Estimated
### Definition of Done (DoD) Checklist
- [ ] Acceptance Criteria complete
- [ ] No Codacy issues greater than minor (in new code)
- [ ] JavaDocs updated/created
- [ ] Code commented
- [ ] Unit tests created/updated
- [ ] 80% test code coverage (in new code)
- [ ] Happy Path and major negative cases in HAPI tests as applicable
Contributor guide
Assessment
This issue has not been assessed yet.