Skip to content

Find and replace optimization for large files #45690

@rebornix

Description

@rebornix

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions