hyperium / http-body

Asynchronous HTTP body trait
MIT License
125 stars 49 forks source link

Backport to_bytes performance optimizations #121

Open rtimush opened 4 months ago

rtimush commented 4 months ago

Backports https://github.com/hyperium/http-body/pull/94 and https://github.com/hyperium/http-body/pull/112.

We had some performance issues and found out that to_bytes() has a quadratic complexity with respect to the number of chunks in the BufList (in our case it was taking 10 minutes to run to_bytes on a ~65MB body). This has been already fixed in 1.x, but 0.4.x seems to be still widely used, so it would be nice to have this fix there as well.