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 #118

Closed bnoordhuis closed 1 year ago

bnoordhuis 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:   [54.341 ns 54.372 ns 54.410 ns]
                        thrpt:  [1.1639 GiB/s 1.1647 GiB/s 1.1654 GiB/s]
                 change:
                        time:   [-6.9861% -6.8834% -6.7832%] (p = 0.00 < 0.05)
                        thrpt:  [+7.2768% +7.3922% +7.5108%]

edit: forgot to copy the Performance has improved. line :derp:

seanmonstar commented 1 year ago

Superseded by #119