-
Notifications
You must be signed in to change notification settings - Fork 472
perf(castore): generate metadata from bytes in in-mem cache #614
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,6 @@ | |
| package store | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "container/list" | ||
| "errors" | ||
| "fmt" | ||
|
|
@@ -299,7 +298,7 @@ func (s *CAStore) generateMetadataFromBytes(name string, data []byte, pieceLengt | |
| if err != nil { | ||
| return nil, fmt.Errorf("new digest from hex: %s", err) | ||
| } | ||
| metaInfo, err := core.NewMetaInfo(digest, bytes.NewReader(data), pieceLength) | ||
| metaInfo, err := core.NewMetaInfoFromBytes(digest, data, pieceLength) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also use it for
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Im planning to remove that function, no method calls it |
||
| if err != nil { | ||
| return nil, fmt.Errorf("generate metainfo: %w", 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.
Is a 0.5% performance improvement worth the extra complexity we are introducing from extra code?
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.
I think given the code addition is very less and it is in the critical part of downloading and generating the metainfo, it should benefit us.