alacritty/alacritty_terminal/src/term
Christian Duerr 3c61e075fe
Improve rendering performance
This PR combines a couple of optimizations to drastically reduce the
time it takes to gather everything necessary for rendering Alacritty's
terminal grid.

To help with the iteration over the grid, the `DisplayIter` which made
heavy use of dynamic dispatch has been replaced with a simple addition
to the `GridIterator` which also had the benefit of making the code a
little easier to understand.

The hints/search check for each cell was always performing an array
lookup before figuring out that the cell is not part of a hint or
search. Since the general case is that the cell is neither part of hints
or search, they've been wrapped in an `Option` to make verifying their
activity a simple `is_some()` check.

For some reason the compiler was also struggling with the `cursor`
method of the `RenderableContent`. Since the iterator is explicitly
drained, the performance took a hit of multiple milliseconds for a
single branch. Our implementation does never reach the case where
draining the iterator would be necessary, so this sanity check has just
been replaced with a `debug_assert`.

Overall this has managed to reduce the time it takes to collect all
renderable content from ~7-8ms in my large grid test to just ~3-4ms.
2021-05-22 22:48:43 +00:00
..
cell.rs Fix replacement of fullwidth characters 2021-04-29 17:06:44 +00:00
color.rs Update dependencies 2021-02-13 18:15:57 +00:00
mod.rs Improve rendering performance 2021-05-22 22:48:43 +00:00
search.rs Add vi/mouse hint highlighting support 2021-04-13 03:24:42 +00:00