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

Feat/perf improv ( 600x ) #9

Merged
merged 4 commits into from
May 20, 2024
Merged

Feat/perf improv ( 600x ) #9

merged 4 commits into from
May 20, 2024

Conversation

mkadirtan
Copy link
Owner

Investigation using the "Blocking Profiler" revealed that a lot of time was spent during buffer reading. Using io.copy to read the full HTTP response, and then reading from that in the memory buffer resulted in a great performance boost. The parsing step initially took around ~300ms, now it is in the sub-millisecond range ( ~500µs ).

Initially, I thought passing the resp.Body directly into the html.Tokenizer would reduce memory usage, without causing any performance issues. However, it seems like every time the application tries to read from the HTTP response, it is an expensive operation.

@mkadirtan mkadirtan merged commit c1c7ece into main May 20, 2024
2 checks passed
@mkadirtan mkadirtan deleted the feat/perf-improv branch May 20, 2024 22:46
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.

1 participant