zkat / miette

Fancy extension for std::error::Error with pretty, detailed diagnostic printing.
https://docs.rs/miette
Apache License 2.0
1.85k stars 106 forks source link

perf(handlers): optimize string-buffer reallocations #387

Closed lucab closed 1 week ago

lucab commented 1 week ago

This improves get_lines() logic by using a string-buffer with a capacity hint. That avoids growing the buffer from zero each time, saving a bunch of reallocations.

This is a forwarded patch from https://github.com/oxc-project/oxc/pull/3897, see there for further explanations and datapoints.