jam1garner / binrw

A Rust crate for helping parse and rebuild binary data using ✨macro magic✨.
https://binrw.rs
MIT License
585 stars 35 forks source link

Add "how to optimize parsers" documentation #130

Closed jam1garner closed 2 years ago

jam1garner commented 2 years ago

Spinning off from #129, making users more aware of this is a good practice.

Most notable things to be included:

  1. how buffering can help perf
  2. how seeks can affect binrw's perf characteristics
  3. how Vec<u8> is specialized
  4. how per-field error handling can add overhead in pathological cases

Also to be considered:

  1. perf debugging tool recommendations (strace, flamegraph)

(If anyone else has additions as to parts of the performance characteristics found to be unintuitive please comment them below)