Skip to content

Instantly share code, notes, and snippets.

@kei10in
Last active April 11, 2018 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kei10in/2c2f11d27833f5f02c67c8a1117c795c to your computer and use it in GitHub Desktop.
Save kei10in/2c2f11d27833f5f02c67c8a1117c795c to your computer and use it in GitHub Desktop.
Comparison with httparse and picohttpparser

Environment:

  • macOS High Sierra Verseion 10.13.4
  • Mac min (Late 2014)
  • 2.8 GHz Intel Core i5
  • 16 GB Memory
  • Rust nighty 2018-04-11

httparse: https://github.com/kamyuentse/httparse/tree/37b77afb394536ad316753fe6a894c2a62f45c53

picohttparser: https://github.com/kevinswiber/picohttpparser-sys/tree/b590c6e1a1e83fab70feea92899043c7d275949d

PR of httparse with SIMD: seanmonstar/httparse#38

Result

Bench with RUSTFLAGS="-C target-feature=+avx2,+bmi" cargo bench --features=nightly

httparse with AVX2 and picohttpparser with SSE4.2.

test bench_httparse       ... bench:         279 ns/iter (+/- 74) = 2519 MB/s
test bench_picohttpparser ... bench:         209 ns/iter (+/- 43) = 3363 MB/s

Bench with RUSTFLAGS="-C target-feature=+sse4.2,+bmi" cargo bench --features=nightly

Both httparse and picohttpparser enable SSE4.2.

test bench_httparse       ... bench:         321 ns/iter (+/- 62) = 2190 MB/s
test bench_picohttpparser ... bench:         211 ns/iter (+/- 10) = 3331 MB/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment