linebender / norad

Rust crate for working with Unified Font Object files
Apache License 2.0
43 stars 12 forks source link

Clear buf #320

Closed rsheeter closed 1 year ago

rsheeter commented 1 year ago

https://docs.rs/quick-xml/latest/quick_xml/reader/struct.Reader.html suggests "if we don't keep a borrow elsewhere, we can clear the buffer to keep memory usage low." We build data structures with copies so as far as I can tell we can clear buf in all the read event into loops.

While we're here, add magic incantation to Cargo.toml make cargo bench -- --save-benchmark work so one can compare against a baseline taken on master. $ cargo bench -- --baseline master generally tells me things are more better than worse. The results of reruns are not stunningly consistent but it mostly tells me a couple of things are faster and occasionally that one is slower.

Feel free to close as not convincing enough or merge as you see fit :)

image