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
50.31k stars 3.1k forks source link

Big files should not crash the app #16120

Open giovannicimolin opened 3 months ago

giovannicimolin commented 3 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

When trying to open a big JSON file, Zed should not freeze.

To reproduce:

Trying to open a 120MB GeoJSON file freezes the app, while VSCode loads the file quickly without any issues (with highlighting disabled).

Note: I can't upload files bigger than 25MB here, but I think any big JSON will cause this issue.

Environment

Zed: v0.146.5 (Zed) OS: Linux Wayland manjaro unknown Memory: 15.3 GiB Architecture: x86_64 GPU: Intel(R) Xe Graphics (TGL GT2) || Intel open-source Mesa driver || Mesa 24.1.5-manjaro1.1

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

Zed.log

No logs, it just freezes.
failable commented 3 months ago

(with highlighting disabled).

Have a setting like large-file-warning-threshold in Emacs would be great. If the file is larger than the threshold, the file will be opened literally without any latency and issue.

notpeter commented 3 months ago

For me Zed is able to open a 1.2GB text file without crashing, so I wonder if this is JSON specific. Does Zed still crash if you rename the file from .json to .txt?

Zed performing poorly with buffers >16M lines long is a known issue:

wlinna commented 2 days ago

For me Zed freezes and crashes for a 166 MiB JSON file just the same regardless of the file extension, so it's not JSON specific. But all that text is on one line, so it might have something to do with that