Hacker News new | ask | show | jobs
by twoquestions 239 days ago
It's extremely refreshing to see the editor's memory and processor usage be smaller than the webapp tab I'm working on.

I'm really liking it thus far!

2 comments

Its binary is half a gig in size, so just like a browser, nothing fresh about that.
It has a huge amount of treesitter modules, etc., statically compiled into the executable. They're not all loaded the instant you fire it up.
Size on disk is about 64x less relevant than size in RAM for me. To give Zed some credit in this area, it's statically linked and the Linux binary is half the size as the Windows one.
What could they be statically linking to have a 400MB executable?
A tonne of treesitter grammars
They wrote their own graphics renderering library for starters, that's bundled into the editor when compiled.

https://www.gpui.rs/

Every Unity game ships with three UI frameworks (IMGUI, UGUI, UI Elements) built-in, in addition to everything else the game engine supports, and the engine is only about 50 MB.
Is that really necessary for an ide? Seems like a ton of added complexity for little to no trade off or even a downside considering...
Yes. Zed is snappy in a way that makes my copy of Sublime Text 3 feel slow. Compared to VSC it feels like going from a video game at 40 FPS with 2-3 frames of input lag to 120 FPS.
You can read about it here:

https://zed.dev/blog/videogame

A renderer/rendering library for something as simple as a text editor is not (or is not supposed to be) a lot of code and should not take up a large amount of space in a binary. Odds are good it's the embedded Treesitter grammars and other things that Zed uses that takes up space.

It is Rust software, so there is probably a good 50-90% waste when it comes to just raw needed vs. actual lines of code in there, but there is no way anyone makes a renderer so overcomplicated that it takes up a meaningful part of the 500 MB or so Zed takes up on Windows.

The OS loads the entire binary into RAM.
It loads on demand, and pages you don't use don't need to be on RAM
considering how cheap storage is nowadays nitpicking about binary size is a very weird take. Are you editing code on an esp32?
Why don't you actually do some considering how mistaken this superficial dismissal is: storage is not cheap where it matters - for example, your laptop's main drive. It doesn't help you that an external hard drive can be purchased cheaply since you won't be able conveniently upgrade your main mobile system. Also, the size of various used content (games/photos /videos) has increased a lot, leaving constrains on storage in place despite the price drop.
I just refuse to use any software that baloons it's filesize. Not because I can't afford storage, but because there are always alternatives that have similar features and packed into fraction (usually less than 1%) of filesize. If one of them can do it and other can't, it's a bad product, that I have no intention to support.

We should strive to write better software that is faster, smaller and more resilient.

"Storage is cheap" is a bad mentality. This way of thinking is why software only gets worse with time: let's have a 400mb binary, let's use javascript for everything, who needs optimization - just buy top of the shelf super computer. And it's why terabytes of storage might not be enough soon.

I can empathize with how lazy some developers have gotten with program sizes. I stopped playing CoD because I refused to download their crap 150+ GB games with less content than alot of other titles that are much smaller.

That said, storage is cheap, it's not a mentality but a simple statement of fact. You think zed balloons their file sizes because the developers are lazy. It's not true. It's because the users have become lazy. No one wants to spend time downloading the correct libraries to use software anymore. We've seen a rise in binary sizes in most software because of a rise in static linking, which does increase binary size, but makes using and testing the actual software much less of a pain. Not to mention the benefits in reduced memory overhead.

VSCode and other editors aren't smaller because the developers are somehow better or more clever. They're using dynamic linking to call into libraries on the OS. This linking itself is a small overhead, but overhead none-the-less, and all so they can use electron + javascript, the real culprits which made people switch to neovim + zed in the first place. 400mb is such a cheap price to pay for a piece of software I use on a daily basis.

I'm not here to convince you to use Zed or any editor for that matter. Use what you want. But you're not going to somehow change this trend by dying on this hill, because unless you're working with actual hardware constraints, dynamic linking makes no sense nowadays. There's no such thing as silver bullet in software. Everything is a tradeoff, and the resounding answer has been people are more than happy to trade disk space for lower memory & cpu usage.

Does static linking really reduce memory and cpu usage significantly compared to dynamic linking?
I keep hearing this since I've got my first Pentium 1 PC, that storage is cheap.
RAM is not cheap. Executables live in RAM when running.
Executables lives in pages of RAM and not all pages are in physical memory at once.
No, they're mmapped to RAM. Only the pages that get used are loaded to RAM.
Absent evidence to the contrary, the reasonable assumption here is that all of those pages are being used. The rest compiler is not in the habit of generating volumes of code that aren’t being called.
That would be asking to prove a negative, which isn't reasonable.

Also, the question isn't if the code isn't used, it is that it isn't used simultaneously. Almost all software has many features which aren't used simultaneously. For example, it is unlikely you have all of the different language parsers loaded at the same time, because most projects use only a few.

Only the parts that are being used (the working set).
Just be sure about that because zed fires up node as well for lsp.