Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find and replace optimization for large files #45690

Closed
rebornix opened this issue Mar 13, 2018 · 3 comments
Closed

Find and replace optimization for large files #45690

rebornix opened this issue Mar 13, 2018 · 3 comments
Assignees
Labels
editor-find Editor find operations editor-textbuffer Editor text buffer on-testplan
Milestone

Comments

@rebornix
Copy link
Member

When users run find in a single file, we will run regex line by line originally. Now we have a text buffer which stores content in chunks instead of lines, running regex on chunks directly can avoid the overhead of getLineContent.

Things to note while doing this optimization

  • When a line sits across Piece Tree nodes/buffers, we fall back to getLineContent then search.
  • When users search by multiline regex, we need to get the whole content and then search, like before.
  • When users search by single line regex, but the regex contains ^, $ or similar, executing this kind of regex on chunks will miss matches when there are line breaks.
@rebornix rebornix self-assigned this Mar 13, 2018
@rebornix rebornix added this to the March 2018 milestone Mar 13, 2018
@rebornix rebornix added editor-find Editor find operations editor-textbuffer Editor text buffer labels Mar 13, 2018
rebornix added a commit that referenced this issue Mar 13, 2018
@rebornix
Copy link
Member Author

Benchmark on 1GB file

Line Array
image

Search is slow, but deltaDecorations is just operating on the interval tree

@AlCalzone
Copy link

AlCalzone commented Mar 22, 2018

This is probably related, but feel free to open another issue if its not:
When opening a large log file (30k lines in my case), I can reliably freeze the window just using search. Steps to reproduce:

  • Open large file
  • Enter the following in the search box with regex enabled: $\n

As soon as the n is entered, VSCode freezes and asks me a couple of seconds later if I want to restart the current window.

Version 1.21.1
Commit 79b44aa704ce542d8ca4a3cc44cfca566e7720f1
Datum 2018-03-14T14:47:13.351Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architektur ia32

@rebornix
Copy link
Member Author

@AlCalzone we didn't optimize regex searching yet but it's on my palette.

@vscodebot vscodebot bot locked and limited conversation to collaborators May 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-find Editor find operations editor-textbuffer Editor text buffer on-testplan
Projects
None yet
Development

No branches or pull requests

3 participants