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

Finding “\n” using regular expression is very slow in a file containing a lot of lines #41503

Closed
EFanZh opened this issue Jan 12, 2018 · 4 comments
Assignees
Labels
editor-find Editor find operations
Milestone

Comments

@EFanZh
Copy link
Contributor

EFanZh commented Jan 12, 2018

  • VSCode Version: 1.19.2
  • OS Version: Windows 7 64-bit

Steps to Reproduce:

  1. Create a file with 10000 lines.
  2. Type \n in the find widget and turn on “Use Regular Expression”.

Does this issue occur when all extensions are disabled?: Yes

Also, searching for ^ and $ is still fast.

@EFanZh EFanZh changed the title Find “\n” using regular expression is very slow in a file containing a lot of lines Finding “\n” using regular expression is very slow in a file containing a lot of lines Jan 12, 2018
@alexdima
Copy link
Member

alexdima commented Jan 18, 2018

On my machine, searching for \n in a file with 25k lines is dominated by:

  • (40ms) actually finding \n 20k times
  • (67ms) creating 20k decorations

image

I can look into optimizing this specific search (~40ms), as searching for \n is trivial.

@alexdima alexdima added the editor-find Editor find operations label Jan 18, 2018
@EFanZh
Copy link
Contributor Author

EFanZh commented Jan 19, 2018

@alexandrudima It seems that I can only reproduce this issue on Windows platform. It is fast on my Linux PC. It takes me 4 to 20 seconds to search for \n on Windows, depending on the hardwares.

@alexdima alexdima added this to the January 2018 milestone Jan 22, 2018
@EFanZh
Copy link
Contributor Author

EFanZh commented Jan 23, 2018

@alexandrudima Did you test it on Windows? I couldn’t reproduce it on Linux, so I think this is a platform-specific issue.

@EFanZh
Copy link
Contributor Author

EFanZh commented Jan 24, 2018

@alexandrudima I have tested your fix on version 1.20.0-insider (84991c4). Searching for \n is fast on Windows now, but searching for .\n is still very slow. Still, this problem only appears on Windows.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-find Editor find operations
Projects
None yet
Development

No branches or pull requests

2 participants