diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-06-16 17:50:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-16 17:50:44 +0000 |
commit | bfd62ef45bedf02a4f61c08bba134a2eb06c0b47 (patch) | |
tree | e83f6220aaab971b61c7216a6ea4198ddbd8b165 /alacritty-completions.zsh | |
parent | 4631ca4db5faf10eb0276e3968814a68c86c81ee (diff) | |
download | alacritty-bfd62ef45bedf02a4f61c08bba134a2eb06c0b47.tar.gz alacritty-bfd62ef45bedf02a4f61c08bba134a2eb06c0b47.zip |
Optimize indexing of the grid's raw buffer
The `compute_index` method in the `Storage` struct used to normalize
indices was responsible for a significant amount of the CPU time spent
while running the `alt-screen-random-write` benchmark (~50%).
The issue with this relatively simple method was that due to how often
the method is executed, the modulo operation was too expensive.
Instead of the modulo, a more conservative branch has been put
in place which has a very efficient best-case (which is hit most of the
time).
Until now the methods for growing/shrinking the storage buffer and
compute_index have been written with the assumption that `self.zero`
might be bigger than `self.inner.len()`. However there is no reason why
`self.zero` wouldn't be constrained to always be within the size of the
raw buffer, so this has been changed to make things a little simpler and
more explicit.
Instead of clamping the selection to be within the buffer inside the
storage, this is now checked in the selection logic to remove all
selection-specific logic from `storage.rs`.
Diffstat (limited to 'alacritty-completions.zsh')
0 files changed, 0 insertions, 0 deletions