amphp / hpack

HPack - HTTP/2 header compression implementation in PHP.

Home Page:https://amphp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nghttp2 implementation using FFI

kelunik opened this issue · comments

PHP 7.4 offers FFI, so we can build the huffman decoding using nghttp2 and FFI if both are available on the given system and otherwise fall back to our current implementation.

Sounds reasonable - though you probably should measure the FFI overhead for small inputs and check whether our userland or the FFI impl is faster (i.e. for input sizes of around ~200 bytes).

If there's only a slight overhead, I'd still prefer an FFI implementation, because the current implementation needs about 30 MB of RAM.

I have started working on an implementation locally.

I have a working implementation locally now and the initial test with the included script shows some speed up.