Skip to content

Conversation

Vizonex
Copy link

@Vizonex Vizonex commented Oct 5, 2025

These are my ideas on optimizations to make to make hpack run a bit smoother since it's pure python and I know of a few techniques that could help the code get moving and possibly help remove some lag if any are present.

There's some exciting plans happening including aiohttp getting this dependency hence my contributions.

fixes #284

This is still a draft but hopefully someone could help me review my changes :) I should be pretty responsive as my other goals in my agenda are just waiting on people to respond so I have plenty of time on my hands on this end.

Edit: It's not a draft anymore it's ready. :)

@Vizonex Vizonex changed the title HuffmanDecoder Class to help reduce lag among multiple threads incase needed. HuffmanDecoder Class to help reduce lag and transform some constant values to arrays Oct 5, 2025
@Vizonex Vizonex changed the title HuffmanDecoder Class to help reduce lag and transform some constant values to arrays HuffmanDecoder Class to help reduce lag and other various performance optimizations Oct 5, 2025
@Vizonex Vizonex marked this pull request as ready for review October 5, 2025 03:51
@Vizonex
Copy link
Author

Vizonex commented Oct 5, 2025

I used ruff format src tests Hope you don't mind that at all.

@Kriechi
Copy link
Member

Kriechi commented Oct 5, 2025

Please keep the style changes and other refactoring out of this PR - it makes reviewing the main changes difficult for me.
We can review those changes in a follow-up PR.

Please explain the changes around HuffmanDecoder and the usage of array. I don't yet understand how the previous behaviour should have not been thread-safe, or what errors you encountered. As mentioned previously, the hpack library needs external safe-guards in any case. Please build a reproducible benchmark test and show results that your changes are better.

@Vizonex
Copy link
Author

Vizonex commented Oct 5, 2025

@Kriechi I'm gonna shut down this pr and restart from scratch. Maybe we could add pytest-codspeed first and then start optimizing so that we get a clear idea of what we need to improve?

@Vizonex Vizonex closed this Oct 5, 2025
@Vizonex Vizonex deleted the decoder-optimizations branch October 5, 2025 14:57
@Vizonex
Copy link
Author

Vizonex commented Oct 5, 2025

@Kriechi I made a new pr but this time it's just benchmarking tools #286

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.

Decoder isn't Threadsafe.

2 participants