mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 14:20:35 +00:00
When working on https://github.com/zed-industries/zed/pull/45969 I've noticed that whenever I try to open a binary file ``` ~/Desktop/svenska ❯ du -ha "Svenska А2B1. 07.09.2025 [u6qEIe9-COc].mkv" 456M Svenska А2B1. 07.09.2025 [u6qEIe9-COc].mkv ``` Zed allocates all its size <img width="214" height="104" alt="image" src="https://github.com/user-attachments/assets/e67ad522-b8a4-4e8e-9961-13030a34df1c" /> <img width="345" height="154" alt="image" src="https://github.com/user-attachments/assets/ea691020-0d02-4acc-88c3-476385f309bb" /> only to show me this: <img width="979" height="677" alt="image" src="https://github.com/user-attachments/assets/ff91cc9d-eb59-4cee-b06f-5758acd1bd5d" /> Given that our existing code checks first 1024 bytes to decide whether to bail on a binary file or not, this seems very wasteful — hence, adjusted the code to read the "header" and check that first, and only continue reading the entire file after the checks are successful. I suspect this should also help the project search, esp. the crashes and memory usage during that when many binary files are present? Release Notes: - Improved Zed's memory usage when attempting to open binary files |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-GPL | ||