-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Optimize read to max #1714
Optimize read to max #1714
Conversation
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.
very nice!
pkg/handlers/archive.go
Outdated
if fileContent.Len() == maxSize { | ||
logger.V(2).Info("Max archive size reached.") | ||
return fileContent.Bytes()[:maxSize], nil | ||
} | ||
|
||
return fileContent.Bytes(), nil |
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.
Could this be simplified now to
if fileContent.Len() == maxSize {
logger.V(2).Info("Max archive size reached.")
}
return fileContent.Bytes(), nil
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.
oh yep yep, nice.
Description:
Use the std lib's CopyBuffer to speed up the copying process. We lose some granularity with this approach but the performance gains I think are well worth the tradeoff.
Checklist:
make test-community
)?make lint
this requires golangci-lint)?