dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.17k stars 9.93k forks source link

Use Huffman code in HPackEncoder #4742

Open JunTaoLuo opened 6 years ago

JunTaoLuo commented 6 years ago

Currently we are using a direct encoding when we encode headers. We can optimize by using Huffman code: https://tools.ietf.org/html/rfc7541#section-2.4.

Related work:

JunTaoLuo commented 6 years ago

Might be able to leverage the code at: https://github.com/aspnet/KestrelHttpServer/blob/423d5432be5206849cd90cc0f524aed0ec8d028b/src/Kestrel.Core/Internal/Http2/HPack/Huffman.cs.

scalablecory commented 4 years ago

See https://github.com/dotnet/corefx/pull/41805 where I updated our shared HPackEncoder to support this.

I prototyped it a few different ways and found that even with lots of optimization, the CPU usage introduced by Huffman coding was unacceptable.

davidfowl commented 3 years ago

@JamesNK did we do this?

JamesNK commented 3 years ago

No.

I don't think huffman encoding is very valuable. We'd only use it with large header values and only if not already compressed with HPack.

davidfowl commented 3 years ago

Should we close then?