1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:57:35 +00:00

LibLine: Avoid excessive write() syscalls when refreshing the display

Previously, we were generating the display update one character at a
time, and writing them one at a time to stderr, which is not buffered,
doing so caused one syscall per character printed which is s l o w (TM)
This commit makes LibLine write the update contents into a buffer, and
flush it after all the update is generated :^)
This commit is contained in:
Ali Mohammad Pur 2021-07-19 23:12:28 +04:30 committed by Ali Mohammad Pur
parent 0f6654fef2
commit 3184086679
5 changed files with 126 additions and 110 deletions

View file

@ -12,13 +12,13 @@
namespace Line {
namespace VT {
void save_cursor();
void restore_cursor();
void clear_to_end_of_line();
void clear_lines(size_t count_above, size_t count_below = 0);
void move_relative(int x, int y);
void move_absolute(u32 x, u32 y);
void apply_style(const Style&, bool is_starting = true);
void save_cursor(OutputStream&);
void restore_cursor(OutputStream&);
void clear_to_end_of_line(OutputStream&);
void clear_lines(size_t count_above, size_t count_below, OutputStream&);
void move_relative(int x, int y, OutputStream&);
void move_absolute(u32 x, u32 y, OutputStream&);
void apply_style(const Style&, OutputStream&, bool is_starting = true);
}
}