Skip to content
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

download: discard binary messages #63

Merged
merged 7 commits into from
Jun 4, 2021

Conversation

robertodauria
Copy link
Contributor

@robertodauria robertodauria commented Jun 4, 2021

This PR changes the download test to avoid allocating memory for incoming binary messages during the download test, by moving from conn.ReadMessage() to conn.NextReader() and redirecting the output to ioutil.Discard.

This allows for a significant reduction in CPU utilization (~25% according to pprof) and consequently improves performance on resource-constrained hardware (such as embedded ARM devices - Raspberry Pi, ODROID, etc.)

Tested on an ARMv7 ODROID device and further confirmed to improve performance on an ARMv8 (arm64) Raspberry Pi at #59.


This change is Reviewable

Copy link
Contributor

@bassosimone bassosimone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐳

internal/mocks/mocks.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants