320 points · by seanwilson · 8y ago · 225 comments
I want this to work.
Also excited to see the discussion and possible cross-pollination with Xi[1] and raphlinus.
A 3 line file, be it long lines, shouldn't happen
No. It should not.
But that’s completely unfair. Xi does not even claim to be beta. I haven’t touched it in months. But when I did, it was a good (start of) a Mac frontend that was clearly not finished.
The only people I imagine using it now probably use it to dogfood the backend and piece together a solid plugin API.
I would prefer Xi-style win the mind share. Native front ends that tie to a common solid backend that a large community can share to build strong plugin support.
I’ll settle for xray-style, a better cross-platform frontend that doesn’t redraw large portions of the DOM quite so often. Javascript is fast enough. A good (heh) extension language. The drawing layer is what makes Electron a slow, bloated choice for a text editor.
Since Atom came out, I have had a backgrounded dream that once things settled, they would write a faster front end for the text. But that is difficult to do if your API is “can you do it in the DOM with javascript?
But they are atom.io. They can change their API if they need to.
VS Code, with its well-bounded API is a much better candidate. And I would love to be surprised by a Microsoft skunkworks non-Electron release.
Xi, is a solid idea. Don’t know if they can build a community out of nothing. I am worried that an API of ”here is a JSON firehose, hook up whatever you want to it” will fragment the backend.
I think Xi would be well served by saying “Here is your firehose, but, the official way is our VS Code emulation plugin.” Or something solid and well-defined.
It is unclear where Xi is going so far, that may happen.
I'm starting to get tired of how much of a resource hog Atom is.
90s me would be absolutely floored by a text editor needing 438MB RAM.
Wait, what am I saying? 2018 me is pretty flabbergasted by it, but perhaps less surprised (and more cynical) than 90s me.
That isn't RAM, that's 438MB of drive space. Even the compressed zip download for Atom is bigger than would have fit on that entire hard drive (Atom 1.24 is 123MB zip download).
Though the RAM usage is pretty close, with no files loaded it was using 360MB RAM here.
This is a false dichotomy. Vanilla Emacs needs 38Mb on my machine, and it has all the tools you'd ever need to develop plugins for it. Visual debugger, byte-compiler, object inspector, jump to definition (including straight to C implementation when needed), visual font pickers, color palette, documentation browser & docstring viewer for symbol at point, you name it - it's all there.
Browser engines are not optimized for handling text editing. They are optimized for basically everything else but text editing. You can make them into kind-of OK text editors, but you have to put a lot of effort just to get to where text-editing frameworks are already[1]. And 200Mb of unnecessary code doesn't make getting there any easier.
To my mind, developing a text editor with a web browser is a bad technical decision. It may pay off in the number of devs available and eager to help - it may be worth it, I don't know, it's for the projects' leads to decide. Technically, though, these projects would be much better off with a text-editing framework.
[1] LightTable is a good example here. Well-funded, motivated team worked on it for a couple of years - and still failed to provide anything more than Emacs with plugins. Well, it looked a bit better.
Somehow I think it has more to do with developers not wanting to pay for software than anything else.
XAML coupled with Blend studio is a powerful UI design tool, or stuff like Adobe XD. HTML/CSS not really.
Right now Spotify is taking up 1 GB. VLC can play 4k with less RAM, what the hell?
Steam's minimum storage guideline says 70GB(!).
Not say Atom can't be more efficient, but I think this is often our field's "I remember when a cola was 10 cents".
From the OP:
> In Atom, the vast majority of computation of any given frame is spent manipulating the DOM, recalculating styles, and performing layout. To achieve good text rendering performance, it is critical that we bypass this overhead and take direct control over rendering. Like Alacritty and Xi, we plan to employ OpenGL to position quads that are mapped to glyph bitmaps in a texture atlas.
The problem with JS is that its execution model is built around highly dynamic features that are hard to compile efficiently. It also lacks a nice type system, though Typescript helps a lot.
The problem with Atom performance, I suspect, is mostly with its using a web browser and DOM to exit text. I bet that elisp is seriously slower than JS on v8, but Emacs is faster than Atom, because its presentation layer is more efficient (while less capable).
https://code.visualstudio.com/blogs/2017/10/03/terminal-rend...
Also Common Lisp (much faster than V8), Forth, and probably some Scheme implementations.
You'd lose type safety compared to Rust, but they don't have that with JS now anyway.
I don't think the majority of the memory consumption is from JS though, moreso the embedded browser+DOM approach.
Edit: Blaming electron for bloat more than JS.
True.
But there are also other dynamic languages that can go as fast as LuaJIT and of course faster than V8: Common Lisp and some Scheme implementations.
Both are very elegant languages, moreso than Lua (which is very peculiar.)
However, for the goals of an editor, my choice would be Free Pascal with Lazarus. It is already complete for cross-platform UI deployment. And compiled code is really fast.
And also Node.
I'm on emacs and firefox for good.
I remember when my Dad paid a small fortune for a 386 with a 27mb hard disk which was considered insanely huge amount of disk space at the time.
Another thing that's interesting is that if they're targeting a web-embedded editor (mentioned as a goal), they could possibly reduce the need for a full Electron install, possibly using the Rust web-view bindings[1] to link with the system web engine.
> 8ms Scrolling, animations, and fine-grained interactions such as typing or cursor movement.
I don't believe that. Either they use expensive powerful hardware or they measure performance only on start with empty documents. Because even Sublime Text starts lagging after long use and typing several pages of text. There is no way HTML page can be faster than optimized native code.
Especially with React (which adds even more overhead and which was never made for high performance) and these weird ideas:
> a CSS-in-JS approach that automatically generates atomic selectors so as to keep our total number of selectors minimal.
So have all the slow, under-performing, crash prone, unoptimized AAA flops.
C++ isn't a magic bullet that gives instant speed. Indeed a long running native app that isn't properly written, will fragment the heck out of memory and get slower and slower. (With 64bit address spaces, at least they don't crash now days!)
The choice of algorithms and data structures is of utmost importance. Optimizing around one's run time is choice #2. C++ doesn't provide some magic hyper optimized environment. Heck C++ doesn't provide much of anything. You need to build a threading model and concurrency model that works, and performs well on different platforms. File I/O performance is different based on the file system in use, NTFS for example hates lots of small files, other file systems have less issues with that usage model.
This goes on and on and on. With C++, every decision has to be made, and each one of those decisions can, if made incorrectly, lead to a poorly performing app.
react/html/css/js is used for extensions and probably menus, etc.
For the desktop, they could cut out Electron entirely and replace it with V8 and some minimal OpenGL bindings. I wonder how that would improve performance!
It looks like this latest effort is ditching most of the web browser stuff, and some of the web technologies to build something performant and extensible. Just like Sublime Text (and others). Have we come full circle?
I feel like the original Atom, as you described, was almost the internal prototype that got out in the wild, and now we're going to get the production-ready one eventually..
Long before Electron I saw applications that ran on localhost in your own browser (think SlickBear, CouchPotato and Headphones) and they were highly responsive regardless of browser used! They were all coded in Python too, so I can only imagine if some of those native API's could just be done as a web api instead to keep things simpler, then you just need to identify a REST framework to handle some of those things. Anyone could add on to a RESTful API for the editor / call said API as well, though it should be locked down securely for obvious abuse reasons.
I used to like the idea of taking nw.js and making something like Atom (before it was even a thing) but using D as a back-end language for it, but never really got through doing it. Ah well.
Edit:
I also find it funny they're ditching CSS for JavaScript when Firefox redid their CSS engine in Rust. I have to wonder if and when Electron will deviate from Chrome altogether and become it's own forked browser engine, but maybe that's a thought a bit ahead of it's time.
I want to build a text editor where git history is displayed as first class files directly in the file tree. Like a page named landing.html would have landing.html.v0, landing.html.v1, landing.html.v2, etc. directly as regular files. With maybe the git commit message also in the file name for more context.
What would be the best way to make this happen? Build an app from scratch with something like Electron? Build an extension for an existing text editor like Sublime, VSCode, or Atom?
> More concretely, our goal is to ship a high-performance standalone editor component suitable for use in any web application, something we could eventually use on GitHub.com. This standalone editor will give us a chance to test a limited set of critical features in production scenarios without building out an entire desktop-based editor. We plan to develop this new editor in the context of a prototype Electron application, but we'll offer the standalone component as a separate build artifact from the main app.
I really wish the Servo technology was available in something like Electron which would make this unnecessary
Why not? Modern desktops are all hardware-accelerated anyway.
They will render text to a bitmap using HTML canvas and then use that as a texture for GPU.
GPU will be compositing those bitmaps, it won't actually be rendering text.
I've written a OpenGL engine for a university course that use partial frame updates to reduce the number of redraws per frame.
IIRC the partial rerender variant was about 3 times faster than the full render.
try drawing a 5k monitor full of true type fonts in software sometime.
Things like filling rectangles or scrolling have been hardware optimized for years on Windows without using any OpenGL and it works even on ancient graphic cards. So I think it might be a better technology for a text editor.
Yes - for example, Apple has been shipping 5K 27” displays in iMacs for three years now.
I can make it.
In fact, there are many native text editors out there.
The problem is not creating the editor itself but the community around it. If your editor doesn't supports the most common/basic plugins like linters, debuggers, painters, formatters, code intelligence, etc then it becomes another one in the pile.
Atom became the popular piece of software that is today because of the JavaScript community. Hundreds of high school, college and university students with several hours of free time during the week, writing code in a language that overflows on the Internet, to extend the functionality of a program baked by one of the most popular companies among software developers [GitHub]. This is the type of community that you need to build around your editor in order to make it popular.
Take a look at TextMate [1] which used to be one of the most popular code editor with a graphical interface for Mac years ago. It was open-sourced [2] after its developer put it in maintenance mode. And while it is still being maintained today, not many people are well versed in C++ and Objective-C to contribute to the project at the same speed as a JavaScript programmer would do with Atom.
Citation definitely needed.
If you want linters or code intelligence, there's an emerging editor-agnostic solution for that as well. The guys behind the Language Server protocol[1] realized that making an editor plugin for each language in each editor was inefficient and it slows the adoption of new languages and new editors.
There are plenty of people who keep trying to do that, but a lot of people have moved away from it because “native” means one of:
(1) excluded important platform for developers, or
(2) multiplies maintenance effort and new feature development difficulty by requiring the project to maintain large amounts of platform-specific code for several different platforms (which ends up turning into a platform abstraction layer.)
It's a lot more efficient, in developer time, to choose an existing, well-supported engine that already abstracts the native platform, and focus on developing and maintaining the unique features of your editor instead.
> Any sufficiently complicated program with an extensible cross-platform GUI contains an ad-hoc, informally-specified, bug-ridden implementation of half of a webrowser.
Starting by the fact that not only there are commercial native compilers, Java 9 also started the road to have AOT compilation support with the long term plan to replace the C++ parts with Java (aka System Java, Project Metropolis).
Also there are hooks in Swing and JavaFX to interact with the host GUI, or if using something like SWT a pure native wrapper to host GUI controls.
I'd kill for new editors trying new and interesting methods of text (or code) navigation and editing, but so often i don't feel like i see... anything, new. The only one i can recall offhand is Kakoune, which is basically Vim-like but changes the verb order a bit. It's a nice attempt, i like it.
Yet with things like Atom, Xi, Xray, i don't get what they're doing special?
I totally get that focusing on easy plugins could be a major selling point. I'm not disputing that or ignoring it. I'm merely trying to.. well, i guess understand, why so many new editors pop up but don't try anything new. They just try.. speed, generally.
Am i alone here? I want more Kakounes of the world.
Maybe text editors with an extensible feature set really are more complex than we've been led to believe?
It's a bit weird to bring up scripting languages. The problem is that people want a customizable and scriptable editor. Solving that problem by providing a script language to its users is not overengineering, it's simply meeting a demand.
Looking at this, it uses some native facilities simply to setup a web browser view. Within that, it doesn't even use the built-in functionality of a browser to render the text you're editing, but resorts to custom rendering and layout using webgl. This isn't simple or clean. It's a convoluted waste of resources in that regard. Why not use one of the smaller cross-platform OpenGL wrappers?
Maybe it'll be a fine editor, but it's much more complex than it needs to be. I guess that because they set a "Web-compatible build artifact" as a goal on the roadmap, it makes sense, but is that really an interesting goal? What problems will be solved once the editor is a tab in Chrome?
It's extraordinary how wasteful some apps can be.
If you work with hundreds of files per day as part of your profession, you are going to want something a bit better. I wouldn't call it over engineering if it solves a real problem.
Why would you think there's no need for sophistication in text editors? They're used to do a lot of complicated things.
[0]: http://kparc.com/
[1]: https://kx.com/
[1] https://www.reddit.com/r/rust/comments/7qszkz/xray_an_experi...
https://github.com/atom/xray/issues/4#issuecomment-359483293
I almost switched to Vim a few months ago, but the impact to my performance was too high for me to keep it up for long enough.
I'm definitely going to be using Xray the moment it becomes stablish.
I don't understand why these electron editors are popular at all. With all due respect to the people working on them (because it really isn't their fault for the most part), they're bloated slow pieces of shit. I don't like electron in general, but its an especially bad choice for a text editor intended for developers.
If you don't like vim or emacs, sublime does what the electron editors do but better. Its probably the most performant of all the text editors I've used; vim and emacs both don't like gigantic logfiles, but sublime handles them without issue. The only bad things I can say about it are lacking vim emulation and worse dev experience than Emacs. But then again, I've never used an editor anywhere near as nice as Emacs in terms of language integration for a lot of the languages I work with.
IMHO it's the future of IDE's. After years of using vi and Intellij IDEA, I've switched to VS code (which is electron based) and never looked back. I find it as snappy as vi or sublime. I feel more productive because of all the plugins. For e.g. the fantastic https://github.com/eamodio/vscode-gitlens
Extending it is really easy using the language server protocol http://langserver.org/ . Our team spent very little effort to build a plugin for our open source project https://github.com/getgauge/gauge-vscode
Electron editors are successful because it's hackable and cross-platform allowing the community to extend and add an impressive list of plugins.
I would like to understand this better too. I'm guessing vim and emacs take too much time to learn, since they drag the whole unix ecosystem with them. Sublime might be a decent easier to learn editor, but it's a non-free product that could disappear one day, you have to go through the hassle of buying it and it's expensive one too. So sublime is not even a choice for most people. This leaves us with electron based editors as an acceptable choice. But obviously bloat, performance still matter and people will choose something better if available.
It's $80. If you work in text all day, then that's practically nothing.
It's kind of disheartening to see how little value people place on excellent software.
I used vim for about 7 years and had a highly customised config with plugins tailored to my workflow. Got to my new job and spent a day trying to get YouCompleteMe installed properly, when I eventually failed I downloaded VSCode and never looked back. Everything's just so much easier to deal with than when I was using vim and I don't notice any performance difference.
I am happy with Vim for myself now, and am glad that I moved beyond the bloated IDE way of thinking, including Visual Studio Code. Yes, Atom had its shortcomings in that arena, but I'd still prefer to use Atom over Visual Studio, due mostly in fact that the project has contributed more to the community. Microsoft has made a single exception to abandon their native language frameworks and to use a bloated JavaScript jungle of software dependency hell that no one ever audits, in order to build a text-editor in a web browser that performs like Crysis and makes you feel that they are mining cryptocurrencies in some encoded javascript module. Vim on the other hand is pure text editor built in quality-optimized C and comes with pretty much every feature baked in. Atom is created and maintained in large by GitHub, and they have a much better reputation towards open source.
All us 'cool elite programmers' as you so blindly follow, have moved onto to use neovim.