New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get rid of hyper by default #15
Comments
Some random notes:
|
I don't think this kind of split would be a net positive. If needed, in the future there could be "client" and "server" default features that can be disabled by users that don't want to build the subset of the functionality that they don't use. |
Wow, sorry, I have somehow missed them. I looked in hyper and they allocate an UniCase string there. Just tried to be faster :) Maybe there is also some .trim() function for bytes that I'm missing?
Hm, I used to think that line folding is implemented in httparse, but it's optional https://tools.ietf.org/html/rfc7230#section-3.2.4:
Maybe I can remove it.
Sounds reasonable.
Well, the library is small enough. Currently, there are no additional dependencies in either of them. Also, rust removes unused code in resulting binary, so should not be a problem. Also, about one-third of the size of the codebase is currently used in both client and server, and this part doesn't have good public interface. However, these would probably be external libraries:
|
Linefolding is indeed implemented in httparse. I just mean you do not need to check for \n and \r in rotor-http. There is no |
Well, then I'm not sure what you mean, I believe that the header:
.. will be received as bytes |
I tried it out with the request |
Yes. That's my conclusion too. I'm not sure this is a deliberate decision or just omission. I probably should test whether headers are work in the wild (with todays clients and servers), just to make sure And another missed comment:
This needs a CaseInsensitiveMultiDict, which is quite complex and ugly data structure. Probably I would keep it for higher level of abstration. In fact I see three cases:
Only the case (3) requires a lookup. And it usually requires only handful of headers (probably only Host). So it may be faster to just scan them once again similarly to what is done to determine request length. There are only ~10 headers in each request and they should be in CPU cache in the |
This can be closed, I think. |
As discussed in #8
It looks like removing hyper in header parsing added about 10% of performance (65k rps vs 72k rps on my laptop on hello world). For certain cases (for example proxies, including fastcgi or similar ones) it makes the interface even simpler.
It's easy to apply hyper on top of rotor-http, and it should not make any noticeable overhead because we don't allocate any additional structures for our own handling of headers.
The work as of v0.5.0 halfway done: input headers (in both client and server) are passed as a slice of
httparse::Header
but the output ones (including status/error codes) are used from hyper.The text was updated successfully, but these errors were encountered: