mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-28 03:41:41 +00:00
Do not call monotonic() when changing cursor position
monotonic() is extremely slow. This call was halving the CSI parsing speed benchmark. Instead we use the time at which parsing of the current input chunk was started. This should be within a few microseconds and accurate enough for the cursor trail for which it is used.
This commit is contained in:
parent
9bf44f0b85
commit
643e534053
3 changed files with 3 additions and 1 deletions
|
|
@ -1805,7 +1805,7 @@ screen_cursor_position(Screen *self, unsigned int line, unsigned int column) {
|
|||
line += self->margin_top;
|
||||
line = MAX(self->margin_top, MIN(line, self->margin_bottom));
|
||||
}
|
||||
self->cursor->position_changed_by_client_at = monotonic();
|
||||
self->cursor->position_changed_by_client_at = self->parsing_at;
|
||||
self->cursor->x = column; self->cursor->y = line;
|
||||
screen_ensure_bounds(self, false, in_margins);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ typedef struct {
|
|||
} paused_rendering;
|
||||
CharsetState charset;
|
||||
ListOfChars *lc;
|
||||
monotonic_t parsing_at;
|
||||
} Screen;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,7 @@ static void
|
|||
run_worker(void *p, ParseData *pd, bool flush) {
|
||||
Screen *screen = (Screen*)p;
|
||||
PS *self = (PS*)screen->vt_parser->state;
|
||||
screen->parsing_at = pd->now;
|
||||
with_lock {
|
||||
self->read.sz += self->write.pending; self->write.pending = 0;
|
||||
pd->has_pending_input = self->read.pos < self->read.sz;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue