diff options
author | Christian Duerr <contact@christianduerr.com> | 2018-04-28 16:15:21 +0200 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-06-02 09:56:50 -0700 |
commit | 8168d85a21b1a67b9cf25808c4e3e01f7437b50d (patch) | |
tree | dd223830f36ad99b2f48ebb7872ac5be67bba10f /tests | |
parent | 31c0f291e0f1b8489366e011a5206e981a68beb2 (diff) | |
download | alacritty-8168d85a21b1a67b9cf25808c4e3e01f7437b50d.tar.gz alacritty-8168d85a21b1a67b9cf25808c4e3e01f7437b50d.zip |
Improve storage comparison algorithm
Instead of iterating over the raw storage vector because the offsets
don't allow direct comparison, the comparison is now done in chunks.
Based on benchmarking this is a lot more efficient than using split_off
+ append or iterating over the elements of the buffer.
The `history_size` field has also been removed from the storage
structure because it can be easily calculated by substracting the number
of visible lines from the length of the raw storage vector.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ref.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/ref.rs b/tests/ref.rs index 0c8c9768..9ea0b80c 100644 --- a/tests/ref.rs +++ b/tests/ref.rs @@ -6,7 +6,6 @@ use std::io::{self, Read}; use std::path::Path; use alacritty::Grid; -use alacritty::grid::IndexRegion; use alacritty::Term; use alacritty::ansi; use alacritty::index::Column; @@ -81,7 +80,7 @@ fn ref_test(dir: &Path) { let grid: Grid<Cell> = json::from_str(&serialized_grid).unwrap(); let mut config: Config = Default::default(); - config.set_history(grid.history_size() as u32); + config.set_history((grid.len() - grid.num_lines().0) as u32); let mut terminal = Term::new(&config, size); let mut parser = ansi::Processor::new(); @@ -91,7 +90,7 @@ fn ref_test(dir: &Path) { } if grid != *terminal.grid() { - for i in 0..(grid.num_lines().0 + grid.history_size()) { + for i in 0..grid.len() { for j in 0..grid.num_cols().0 { let cell = terminal.grid()[i][Column(j)]; let original_cell = grid[i][Column(j)]; |