You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MappedWrite currently manually appends a single element at a time to its buffer in its io::Write implementation (rather than a split and push several at once approach, or similar):
This seems suboptimal from a performance point of view (given MappedWrite's primary use-case is to process the stdout of a process, which could be large in volume).
I happened to spot that the Rust stdlib actually has std::io::LineWriter which does something similar to what MappedWrite does.
MappedWrite
currently manually appends a single element at a time to its buffer in itsio::Write
implementation (rather than a split and push several at once approach, or similar):libcnb.rs/libherokubuildpack/src/write.rs
Lines 107 to 114 in fbf3919
This seems suboptimal from a performance point of view (given
MappedWrite
's primary use-case is to process the stdout of a process, which could be large in volume).I happened to spot that the Rust stdlib actually has
std::io::LineWriter
which does something similar to whatMappedWrite
does.Whilst we can't use
LineWriter
for our use-case (since it doesn't support a way to map the lines), it's possible we could take inspiration from its implementation:https://github.com/rust-lang/rust/blob/master/library/std/src/io/buffered/linewriter.rs
https://github.com/rust-lang/rust/blob/master/library/std/src/io/buffered/linewritershim.rs
The text was updated successfully, but these errors were encountered: