acheronfail / repgrep

An interactive replacer for ripgrep that makes it easy to find and replace across files on the command line.
Apache License 2.0
267 stars 4 forks source link

Various performance improvements #76

Closed acheronfail closed 1 year ago

acheronfail commented 1 year ago

This change includes some performance improvements. Here they are (roughly in order of their impact):

  1. keep track of a visible window and only render visible lines (skip all others)
  2. only iterate the string a single time when calling .to_printable
  3. memoise Item::line_count for a given width, so it's not re-calculated unless the terminal width changes

This also includes some other quality of life changes, as well as decreasing the input flush threshold from 200ms to 20ms.

Fixes #66