Stebalien / term

A Rust library for terminfo parsing and terminal colors.
https://stebalien.github.io/doc/term/term/
Apache License 2.0
178 stars 49 forks source link

`Terminal` should probably buffer #72

Open tbu- opened 7 years ago

tbu- commented 7 years ago

It would be good if the terminal types could have built-in buffering, preferably line-buffering. Currently, every write call in a formatter directly causes a syscall, slowing terminal output down. Additionally, there's no need to flush after every color code on ANSI terminals, it would be more efficient to output them together with the actual text.

In https://github.com/slog-rs/slog/issues/125 you can see that it causes a more than 2x speedup to simply put a LineBuffer around the terminal. On Windows, this would also need to include a flush before the terminal properties are changed to output in a different color.