3 ms·
"Similarly, the Read::lines() iterator is very easy to use, but it has one downside: It allocates a String for each line. Manually allocating and reusing a Stri
by mcguire 9y ago
"Similarly, the Read::lines() iterator is very easy to use, but it has one downside: It allocates a String for each line. Manually allocating and reusing a String will reduce memory churn and may gain you a bit of performance."
Back when Rust used "internal" iterators, this could be the default. Now, you can encapsulate it by passing a function to handle each line.