edit icon indicating copy to clipboard operation
edit copied to clipboard

Very poor performance when opening/searching for very large files (2GB)

Open pansy1110 opened this issue 7 months ago • 4 comments

  1. Search performance problem: When performing keyword search, a card appears, and the response latency is significant, which affects the operation fluency.

  2. Long line display defect: The current display support for long lines is insufficient, and it is recommended to add a horizontal scrollbar for the implementation of complete content browsing.

pansy1110 avatar Jun 21 '25 04:06 pansy1110

Windows 11 pro edit:1.2.0

pansy1110 avatar Jun 21 '25 04:06 pansy1110

Very poor performance when opening

So, is the performance issue with opening files or with searching in them? Your description only talks about the latter.

Search performance problem: When performing keyword search, a card appears, and the response latency is significant, which affects the operation fluency.

We rely on ICU for Unicode-correct, case-insensitive text search. It caps out at <500MB/s so searching in a 2GB file can take up to 4s (or more if your CPU is slow). Our focus is on common file sizes first, because we also want to focus on a small file size. Integrating a fast case-insensitive searcher, particularly with Regex support, would triple the binary size.

Long line display defect: The current display support for long lines is insufficient, and it is recommended to add a horizontal scrollbar for the implementation of complete content browsing.

Computing the horizontal scrollbar width is fairly expensive. The reason other editors can do it is because they either have existed for a long time or have a large team behind it to work on such optimizations. In our case we got 1 part-time developer (me), so such a feature is considered lowest priority (compared to e.g. syntax highlighting, etc.).

lhecker avatar Jun 23 '25 13:06 lhecker

https://github.com/cessen/ropey seems like its purpose is to resolve this sort of issue. But I imagine it would require a lot of refactoring, and probably inflate the binary size too much.

MrDowntempo avatar Jun 25 '25 00:06 MrDowntempo

The overwhelming majority of CPU time is spent in the read syscall, even if the file is fully cached in memory. Whether ropey is used or not would not make any difference (i.e. neither good nor bad).

That said, it would not require a lot of refactoring. All you have to do is implement the WriteableDocument trait on it and use it in the TextBuffer struct.

lhecker avatar Jun 25 '25 00:06 lhecker

I'll close this issue for now due to no response to my question. We currently have no plans to address the search performance. Editors specialized for large files may fare better in that regard.

lhecker avatar Jun 30 '25 12:06 lhecker