aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/input.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2021-05-22 22:48:43 +0000
committerGitHub <noreply@github.com>2021-05-22 22:48:43 +0000
commit3c61e075fef7b02ae0d043e4a4e664b8bc7221e9 (patch)
treef1aa2b0bc18ddea72ef8b989d41fa9d915f6d300 /alacritty/src/input.rs
parentc17d8db16934fa2dbd667acea697cd0682826c80 (diff)
downloadr-alacritty-3c61e075fef7b02ae0d043e4a4e664b8bc7221e9.tar.gz
r-alacritty-3c61e075fef7b02ae0d043e4a4e664b8bc7221e9.tar.bz2
r-alacritty-3c61e075fef7b02ae0d043e4a4e664b8bc7221e9.zip
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.
Diffstat (limited to 'alacritty/src/input.rs')
-rw-r--r--alacritty/src/input.rs5
1 files changed, 0 insertions, 5 deletions
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs
index 3559b85e..948ec67f 100644
--- a/alacritty/src/input.rs
+++ b/alacritty/src/input.rs
@@ -996,7 +996,6 @@ mod tests {
use glutin::event::{Event as GlutinEvent, VirtualKeyCode, WindowEvent};
use alacritty_terminal::event::Event as TerminalEvent;
- use alacritty_terminal::selection::Selection;
use crate::config::Binding;
use crate::message_bar::MessageBuffer;
@@ -1008,7 +1007,6 @@ mod tests {
struct ActionContext<'a, T> {
pub terminal: &'a mut Term<T>,
- pub selection: &'a mut Option<Selection>,
pub size_info: &'a SizeInfo,
pub mouse: &'a mut Mouse,
pub clipboard: &'a mut Clipboard,
@@ -1145,13 +1143,10 @@ mod tests {
..Mouse::default()
};
- let mut selection = None;
-
let mut message_buffer = MessageBuffer::new();
let context = ActionContext {
terminal: &mut terminal,
- selection: &mut selection,
mouse: &mut mouse,
size_info: &size,
clipboard: &mut clipboard,