Dragonfly is an open source P2P-based file distribution and image acceleration system. It is hosted by the Cloud Native Computing Foundation (CNCF) as an Incubating Level Project.
Optimized the pieceDigests slice initialization in the genMetadata function by preallocating space based on t.TotalPieces. This change avoids dynamic slice resizing during runtime, which enhances the performance especially when handling large data sets.
Related Issue
Motivation and Context
Screenshots (if appropriate)
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] Documentation Update (if none of the other choices apply)
Checklist
[ ] My change requires a change to the documentation.
Description
Optimized the pieceDigests slice initialization in the genMetadata function by preallocating space based on t.TotalPieces. This change avoids dynamic slice resizing during runtime, which enhances the performance especially when handling large data sets.
Related Issue
Motivation and Context
Screenshots (if appropriate)
Types of changes
Checklist