seanmonstar / httparse

A push parser for the HTTP 1.x protocol in Rust.
https://docs.rs/httparse
Apache License 2.0
569 stars 110 forks source link

Improve request method parsing #119

Closed lucacasonato closed 1 year ago

lucacasonato commented 1 year ago

Special-case parsing of the GET request method as that is by far the most common. Speeds up the req_short benchmark by a fair margin:

   req_short/req_short     time:   [32.601 ns 32.737 ns 32.914 ns]
                        thrpt:  [1.9241 GiB/s 1.9345 GiB/s 1.9425 GiB/s]
                 change:
                        time:   [-4.1113% -3.5415% -3.0150%] (p = 0.00 < 0.05)
                        thrpt:  [+3.1087% +3.6715% +4.2876%]
                        Performance has improved.

Co-authored-by: Luca Casonato hello@lcas.dev

seanmonstar commented 1 year ago

Thanks! Should I assume this supercedes #118?

lucacasonato commented 1 year ago

Something like that yeah 😁