hpack icon indicating copy to clipboard operation
hpack copied to clipboard

Improve listener interface to reduce common parsing overheaders

Open louiscryan opened this issue 9 years ago • 6 comments

Proposed solution for https://github.com/twitter/hpack/issues/27

Store header names and values as Strings to avoid listeners creating them every time Allow header entries to be annotated with parsed values to allow for higher-level optimizations Broaden header listener interface to accommodate above Add benchmarks

louiscryan avatar Oct 28 '15 00:10 louiscryan

Will take a look in more detail -- I like the idea of being able to cache object representations. Not sure about hardcoding header names. I feel like we may be able to have the user cache them as well via the listener interface.

Sent from my iPhone

On Oct 27, 2015, at 5:12 PM, Louis Ryan [email protected] wrote:

Proposed solution for #27

Store header names and values as Strings to avoid listeners creating them every time Allow header entries to be annotated with parsed values to allow for higher-level optimizations Broaden header listener interface to accommodate above Add benchmarks

You can view, comment on, or merge this pull request online at:

https://github.com/twitter/hpack/pull/28

Commit Summary

Canonicalize the strings produced for header names and values to avoid wasteful string creation File Changes

M hpack/src/main/java/com/twitter/hpack/Decoder.java (56) M hpack/src/main/java/com/twitter/hpack/Encoder.java (2) A hpack/src/main/java/com/twitter/hpack/ExtendedHeaderListener.java (30) M hpack/src/main/java/com/twitter/hpack/HeaderField.java (27) M hpack/src/main/java/com/twitter/hpack/StaticTable.java (32) M hpack/src/test/java/com/twitter/hpack/DecoderTest.java (18) M hpack/src/test/java/com/twitter/hpack/TestCase.java (2) M hpack/src/test/java/com/twitter/hpack/TestHeaderListener.java (8) M microbench/src/main/java/com/twitter/hpack/microbench/DecoderBenchmark.java (101) Patch Links:

https://github.com/twitter/hpack/pull/28.patch https://github.com/twitter/hpack/pull/28.diff — Reply to this email directly or view it on GitHub.

jpinner avatar Oct 28 '15 00:10 jpinner

Jeff - I've tidied up the static table and construction patterns to make them easier to read.

I haven't done anything yet about annotating names. That's next

louiscryan avatar Oct 28 '15 20:10 louiscryan

@louiscryan thanks for taking this on!

jpinner avatar Oct 28 '15 21:10 jpinner

OK. Ready for another round PTAL

I also think it makes sense to retire the old listener interface but I don't know what you've conveyed to folks about API stability

louiscryan avatar Oct 28 '15 23:10 louiscryan

Will try to get to this tomorrow -- as for API compatibility i'm ok with breaking it and publishing 1.1.0 -- there aren't that many consumers.

jpinner avatar Oct 30 '15 00:10 jpinner

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Louis Ryan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jul 18 '19 15:07 CLAassistant