Issue: Responses with large amounts of data are pretty slow compared to Actix + Hyper.
Solution: There are a few factors in this, but most of them rely in how we're storing data to send as a response. This PR addresses a single concern where, in BasicContext, we were converting from Vec<u8> to &[u8] to Vec<u8> and back to &[u8]. This should remove the middle two steps.
Future Work: I'd like to be able to have BasicContext modify the response buffer on the fly rather than just when the response is collected. This should minimize the moving of bytes around, which takes about 18% of the computation right now according to the flame graph.
Issue: Responses with large amounts of data are pretty slow compared to Actix + Hyper.
Solution: There are a few factors in this, but most of them rely in how we're storing data to send as a response. This PR addresses a single concern where, in
BasicContext
, we were converting fromVec<u8>
to&[u8]
toVec<u8>
and back to&[u8]
. This should remove the middle two steps.Future Work: I'd like to be able to have
BasicContext
modify the response buffer on the fly rather than just when the response is collected. This should minimize the moving of bytes around, which takes about 18% of the computation right now according to the flame graph.Should help #118.