zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.95k stars 2.7k forks source link

Improve streaming search speed #4560

Open futurist opened 1 year ago

futurist commented 1 year ago

Check for existing issues

Describe the feature

VSCode uses ripgrep for code search and its speed is amazing.

Ref: https://github.com/microsoft/vscode-ripgrep

In a repo with the same keyword search, Zed is 10x slower than VSCode.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

osiewicz commented 1 year ago

Hi, thank you for reaching out! Can you share a keyword/a snippet where you notice Zed being slower than VSCode?

futurist commented 1 year ago

@osiewicz repo is https://github.com/microsoft/vscode, example keyword: service

osiewicz commented 1 year ago

Yup, this indeed lags quite noticeably. It looks like VsCode has a limit on the # of search results. Therefore, in case of service query we report more results than VsCode, resulting in slower search.

That is not to say that this is not a valid report though - keyword query in VsCode repository does not hit VsCode's limit and we are still noticeably behind. We started investigating the slowness and when result streaming is turned off (== instead of seeing search results come in we update them once at the end), we see a noticeable improvement in keyword query - the time to process it goes down from ~6 s on my machine (M1 Max) to ~2s.

This is not neccessarily related to the regex search itself, more so to the UI updates