Improving startup time in Atom with V8 snapshots(blog.atom.io) |
Improving startup time in Atom with V8 snapshots(blog.atom.io) |
Of course if you're touching the same code over and over again, that's probably a sign you're not solving the problem well. Solving problems with a finality such that they don't have to be reopened again and again is the aim of good software engineering. That is true.
But in order to get there, you need to periodically add a major new capability—and thus a major new assumption—to your architecture. If you're not making these kinds of sweeping changes every now and then it's almost certain that you're not actually doing deep refactors that resolve longstanding challenges in lower energy ways.
Resistance to these kinds of sweeping changes amongst professional developers and their ambassadors at major platform companies is the reason why Windows, iOS, Oracle, and the like have stable interfaces and smaller audiences. On the web you don't need permission to write a whole new JavaScript framework, so people can take those first big steps, even though they are quite painful for the developer.
Lisp I Programmer's Manual, 1960, Page 67
> ... that immediately after all the triplets have been
> evaluated the state of the memory as it stands is read out
> onto tape 8 as the new "base" image for the memory. ...
http://history.siam.org/sup/Fox_1960_LISP.pdfhttps://news.ycombinator.com/item?id=13076098
I quote it in full, here:
OK, if you promise to stay off my lawn, I'll explain the history behind undump. Back in the 70's, the big CS departments typically had DEC 36-bit mainframes (PDP-10, PDP-20) running the Tops10/Tops20/Tenex/Waits/Sail family of operating systems. These are what Knuth used to do all of TeX, McCarthy LISP, and Stallman and Steele EMACS. Not Unix; and Linus hadn't touched a computer yet.
Executable program files were not much more than memory images; to run a program, the OS pretty much just mapped the executable image into your address space and jumped to the start. But when the program stopped, your entire state was still there, sitting in your address space. If the program had stopped due to a crash of some sort, or if it had been in an infinite loop and you had hit control-C to interrupt it, the program was still sitting there, even though you were staring at the command prompt. And the OS had a basic debugging capability built-in, so you could simply start snooping around at the memory state of the halted program. You could continue a suspended program, or you could even restart it without the OS having to reload it from disk. It was kind of a work-space model.
Translating into Linux-ish, it's as if you always used control-Z instead of control-C, and the exit() system call also behaved like control-Z; and gdb was a builtin function of the shell that you could invoke no matter how your program happened to have been paused, and it worked on the current paused process rather than a core file (which didn't exist).
The OS also had a built-in command to allow you to SAVE the current memory image back into a new executable file. There wasn't much to this command, either, since executables weren't much more than a memory image to begin with. So, the equivalent of dump/undump was really just built into the OS, and wasn't considered any big deal or super-special feature. Of course, all language runtimes knew all about this, so they were always written to understand as a matter of course that they had to be able to deal with it properly. It pretty much came naturally if you were used to that environment, and wasn't a burden.
Thus, when TeX (and I presume the various Lisp and Emacs and etc. that were birthed on these machines) were designed, it was completely expected that they'd work this way. Cycles were expensive, as was IO; so in TeX's case, for example, it took many seconds to read in the basic macro package and standard set of font metric files and to preprocess the hyphenation patterns into their data structure. By doing a SAVE of the resulting preloaded executable once during installation, everyone then saved these many seconds each time they ran TeX. But when TeX was ported over to Unix (and then Linux), it came as a bit of a surprise that the model was different, and that there was no convenient, predefined way to get this functionality, and that the runtimes weren't typically set up to make it easy to do. The undump stuff was created to deal with it, but it was never pretty, since it was bolted on. And many of use from those days wonder why there's still no good solution in the *nix world when there are still plenty of programs that take too damn long to start up.
vi had a much simpler structure and much more limited feature set. vim is obviously a much more capable/flexible editor and has scripting support, but is still predominantly written in C.
https://itunes.apple.com/ca/podcast/the-changelog/id34162326...
Compiling a few more seconds to page in. Ssh a few more. Everything on my laptop slows to a crawl as they fight for RAM with Atom taking up the way more than it should.
I know the answer, "buy more RAM it's cheap", from the Atom people, but then my browser people tell me the same thing. So do my interface people, and my kernel people, and by the time I say "okay" to all of them, I'm out of RAM again.
Application need to learn they aren't the only thing running. For some reason, my machine seems to be getting slower and slower no matter how much I upgrade.
What a compliment to the VSC team that after all this work, Atom still doesn't seem to match startup time, or more importantly perceived performance while editing.
It's a more interesting comparison since they're both bound by similar constraints, and building cross platform apps.
In the bad old days I once worked for a MS competitor where there were often complaints of unfair competition. Most often around how knowledge of closed sourced OS internals allowed optimization insights unavailable to others.
Not all MS devs are great for sure, but I'm inferring two things here. The VSC team is pretty damn good, and that IP and institutional knowledge from decades of investment in dev tools probably helps a bit.
Speed is only one of the issues–I'm actually quite happy with Atom in that regard. VSCode has a much more restricted API, and a more robust extension system. With Atom, I always felt like extensions started interfering with each other, and with the 'vanilla' experience. OTOH, I was exploring a few ideas, such as inline rendering of comments in markdown, and that's really only possible in Atom.
In other words, unlike the Atom team, VSCode didn't have to re-make mistakes Microsoft learned from 15 years ago...
And their change logs are great, thankfully.
I tend to work chaotically. I dive into a project and tackle whatever the problem of the day is. The result is a sprawling mess of reference code pulled up in different editor windows, documentation and google results spewing out over 4 browser windows and 30 tabs, and just as many terminals managing VCS, compilation, tests, etc.
It's not that I'm a messy coder or anything; it's just that when I'm focused on a problem then my concern is about that problem, not about the growing heap of reference material. The problem is particularly pronounced when working on web applications, where I have to handle multiple code bases at once.
Once I'm done, I'll become horrified by the state of my desktop and proceed to close everything.
The next coding session starts fresh.
So startup time is actually important to me. I have to say I'm annoyed by VSCode's startup time. It starts up to a state where I can hit the menu and start opening things very quickly, but isn't completely finished for another couple seconds. Atom's in a very similar boat.
I'm glad to see progress being made here.
For anyone curious, I made a quick gif comparing startup times on my machine for Sublime Text 3 (Build 3129), Atom (1.16.0), Atom Beta (1.17.0-beta2, the one mentioned here), VSCode (1.11.2), and VSCode Insiders (1.12)
https://media.giphy.com/media/3ohzdTHkfj5ISAAPq8/source.gif
I should mention - my ST3 is heavily customized (28 plugins), while Atom and VSCode are absolute stock.
Just a lot "snappier". Startup is not much of a problem, I don't open ordinary files in VSCode or Atom by default (I use gedit for that)
Note that this hasn't shipped on stable yet, but is available on 1.17 beta.
The article mostly lists the various problems and associated optimizations. Concise & nice read.
Work from the CRIU crew started getting upstreamed almost exactly four years ago, breaking some initial resistance to the tech needed for CRIU- https://mobile.twitter.com/__criu__/status/58727373960931328... https://criu.org/History
It's interesting the breakdown in sell- CRIU is a swiss army knife of a tool, whereas Snappy Start and V8 Snapshots seem targetted and marketted largely towards fast "initialization" concerns.
The Emacs dumper dispute https://lwn.net/Articles/707615/
There are a few more issues, Emanuel Quimper summarized in: https://equimper.github.io/2017/02/25/why-i-moved-away-from-... explaining why he moved from Atom to VSCode in detail.
A month ago there was an interesting submission in favor of Sublime Text 3. Mainly because of its incredible responsiveness: https://news.ycombinator.com/item?id=13928752 by Tristan Hume, comparing Vim, Spacemacs, Atom and Sublime Text. I highly recommend it.
My workflow now looks like this: VSCode+Plugins replaces my zsh+tmux+vim toolchain when running on AC. On battery zsh+tmux+vim provide VSCode+Plugins functionality with less beautiful gfx but unmatchable battery lifetime.
The zsh+tmux+vim toolchain is heavily customized, though: https://github.com/rscircus/dotfiles
90% of the "innovation" in application programming is just an exercise in combinatorial virtualization.
(That said, it's not all bad. The browser has had a remarkable and wonderful effect on GUI application architecture that probably wouldn't have happened elsewhere.)
For example, starting Atom cold on my medium-sized project (by running `atom .` in the base dir) takes 6 seconds. If I close all windows but leave Atom running, do something else for a while, and then run that command again, it takes 3 seconds.
(That's still a disturbingly long time... but it's quick enough once launched. I like Atom enough that I can live with it for now.)
Edit: just tried the beta. It's a little quicker: 4.5ish seconds and 2 seconds. Still OK for long-term coding but too slow to be $EDITOR for things like `git commit`.
V8 Caching Mode, V8 caching strategy for CacheStorage
https://v8project.blogspot.ca/2015/07/code-caching.html
Edit: Not the same as snapshots mentioned in the article
Most of the time is spent doing fine collisions with shapes coming out of an R-tree to build up a connection graph.
For the vast majority of designs, it's fast. For very dense, imported designs, it can get slow. (No two tools keep data in the same form, so translating leads to inefficiencies.)
Maybe now we can have actual source code protection?
That's what it really comes down to. From what I can see, it's mostly an emotional response. I'd be surprised if code/binary obfuscation is a net win in general.
I've had to disabuse developers of this idea. One distributed binaries that weren't quite valid but ran on the CLR, though not Mono. A 10 line script was enough to remove the invalid sequences. What did the developer gain in this case? An extra build step, undoubtedly more than one bug, and in the end, no "protection".
Better than relying on memory snapshots.
Really I just want my licensing code to not be in a text file so people can't just load up notepad to evade it.
ls ~/.atom/packages | wc -l # minus 1 for the README
Have you checked Timecop? (cmd-shift-p, "timecop") Might be a few you can do without.Cool article regardless
If many people believe this is the case, why not? All articles get some common types of responses based on the topic, this is just one topic/response combo that you happen to disagree with.
>It's a trade off: performance for a cross platform JavaScript app development.
It's an unnecessary tradeoff.
If a single developer can create ST from scratch for Windows, OS X and Linux, then surely GitHub or Microsoft (for VSCode) can create a cross platform native set of UI components in C or C++, wrap them, and have the rest of the development (plugins etc) happen in JS (to keep the familiar language, easy access to npm modules, etc).
This seems destined to go the way of emacs. This is always what happens when an idealistic perspective wins out over a practical one in a development team.
Same here. Start-up time is important when the average user is hitting a web app or application but for developers? We open something once and then keep it open pretty much all day.
Unless I'm an edge case I'd suspect start-up time is mostly meaningless to developers with long running developer tools.
At the same time we always have tons of tools open at once so we need as much memory as possible because once things hit the swap the performance degrades terribly.
I probably spend more time hitting backspace when typing 'atom' than they saved in startup time.
I'll take the license.
I've been feeling this way for years, and I've mostly ascribed it to my faulty perception. I figured that if things simply aren't getting faster (i.e., they're not changing at all), I'm probably just imagining them getting slower.
But then I start wondering why aren't things getting faster...
I'd say buy some more RAM, it IS cheap and you never have too much.
I'm just asking for concealing against my licensing code from being in a text file.
Regardless of how you feel about it, the team behind Atom made a design decision to sacrifice performance to gain a large amount of other benefits ("easier" higher level language, easy cross platform support, extremely easy to write plugins for it from it's target "demographic", etc...).
Because of those architecture choices, things like spawning a new window aren't as easy and straightforward as they might be in another architecture.
So just because you want a method of transportation that goes from 0-60 in 10 seconds, doesn't mean that all methods of transportation need to go from 0-60 in 10 seconds. And just because a method of transportation can't go from 0-60 in 10 seconds doesn't mean the designers were lazy or cut corners, it just means that they prioritised other things, and are solving different problems.
The fact that it's built on web technologies, and web developers can make plugins easily and quickly and can hack on the core code is the entire reason for it's existence, and why it's so popular.
If you rewrite it in another stack, you basically just created an entirely new editor which isn't compatible in just about every way with atom.
There's also the unstated issue of ongoing support for the feature. If they put in code obfuscation they'll be obligated to make sure that it provides adequate protections to avoid a deluge of "someone hacked my obfuscated code" type tickets. What constitutes "adequate protections" will have to be updated over time as more advanced techniques are discovered for reversing out the code.
Combined with the performance drops that were clearly outlined by the Electron devs it would seem like a code obfuscation feature could be a really big waste of time.
No organisation on the planet could compete with a team that Google considers a core asset for actual survival.
Mozilla has made quite a few mistakes, but the times may change, and I sure hope they'll be around when Google's incentives are no longer aligned with the open web's.
Google has lit dumpsters full of cash on fire in an effort to get anywhere near Facebook, Twitter, Whatsapp, Viber or even Signal Private Messenger, and yet their extremely fractured strategy that they have dumped R&D into still has less users than any of those in their respective categories.
Mozilla can be competitive, akin to Darktable vs Adobe if Mozilla chooses to be. No more mucking about bailing their friends out (ie: Pocket acquisition), or trying to fight Google on hardware prices (Firefox OS's entire strategy). Mozilla can create a playing field tilted in their favor, and force others to compete on their turf rather than duking it out on Google or Chinese OEMs turf.
We use canvas, which saves us from the SVG DOM, but it also means managing the scene ourselves. If I ever get some time, I'd like to experiment with a WebGL renderer...
> V8 snapshots allow Electron applications to execute some arbitrary JavaScript code and output a binary file containing a serialized heap with all the data that is left in memory after running a GC at the end of the provided script.
In emacs, the only missing part is that perhaps nobody has already written the elisp that makes it do whatever task you are asking for.
emacs is a smallish program written mostly in C that defers to a scripting language for nearly everything, and it ships a bunch of code in that scripting language that does all the work of being an editor. You can look at that code using the editor itself, and you can change that code using the editor itself. It's insanely flexible and extensible; see e.g. advice [0], and most modules provide meaningful hooks for you to add your own code.
All the IDE/editor behavior is just code. If it's compiled and baked into your IDE, fixed, unchanging, then if there is any behavior you don't like, you better hope the dev included a knob that lets you tweak it, or you have a lot higher barrier to making your editor work the way you want it to.
[0] https://www.gnu.org/software/emacs/manual/html_node/elisp/Ad...
Spending a few hours to configure it to your liking. In fact if you start atom and wait 6 seconds for it to start just once a day then twice wait 3 seconds for a new window you will in the same time frame have waited 8 hours for atom to start.
Hilarious. Emacs is one of the most successful programs of all time in my book. If I ever made an editor I'd pray every night that it'd be at least half as successful as Emacs.
Also, emacs is one of the most successful text editors so I'm not sure I get your comparison.
Also, surely it's not that hard to switch languages? In my experience all languages are essentially the same.
That's the problem: you don't seem to have enough experience.
There are some really giant projects where that becomes reasonable, but for me thats just not the case. And if I were going to invest time like that, I'd rather invest it into an environment which has a higher ceiling for what it can do (emacs doesnt provide fast/rich/easy autocomplete, for example)
but, if what you're working on is not common, maybe there isn't a (good) IDE either.
You don't really want to implement all of that in VIM because your work won't be portable.
So as far as actually talking about my point goes, what exactly am I missing? There are small differences but I've never seen a language that I couldn't get up and going in over the course of a week.
How much experience do you think I have? I've used plenty of languages, and I'm well aware that there are nuances.
That's because you either used the languages superficially, or use only very similar languages, probably of the Algol family (e.g. Ruby, Python, PHP, JS, etc).
You won't get very far with Haskell "over the course of a week". Or APL. Or Idris. Or Erlang. Or Lisp -- or any other language that's not a mere Algol derivative with some different bells and whistles. And even those have their idioms, of course, that one needs much more than a week to get competent with, but, it gets worse when we expand languages to not be "mainstream Algol derivatives". One would only be using languages like Smalltalk, OcamL, Scheme, Scala, Self, etc, superficially without getting into their idioms and nuance, which wont happen in a week (and can take years to really master).
Based on the fact that you think all programming languages are essentially the same. That's just a ridiculous claim and it immediately exposes you as someone who's only used a couple of Algol derivatives.
1. I don't think literally all programming languages are the same
2. I have used Haskell, and am very aware of every language listed in the other replies to this comment, so you're completely wrong.
I kind of thought this community was better than this, to be honest.
One of the reasons why some people are switching from ST to Atom/VSCode is the former's tortured development schedule, which has seen months or years go by without an update. Contrast VSC, which reliably delivers a heap of improvements every month. JavaScript is probably responsible for a big portion of this. Again, it's a tradeoff.
> then surely GitHub or Microsoft (for VSCode) can create a cross platform native set of UI components in C or C++,
Maybe they can. Or maybe they can't, and if they tried then they'd have the same slow pace as ST. You don't know.
That said, one of the Atom developers says using web technologies made development harder in many ways.[1] Very few solo developers can match a team with Microsoft's resources, and a monthly release schedule is more about discipline than anything else.
I am pretty sure the project being open source and in the hand of a team in a big company instead of an independent developer has more to do with it.
Because such comments tend to be repeats, making them not interesting. They also tend to derail interesting discussion. When there's an article on an interesting detail about X, but the top comment litigates why X should even exist, the interesting part of the article never gets discussed. And when that happens on all threads that involve any aspect of X, it's boring.
Someone already has done it. An one-man-shop built Sublime Text by himself.
Surely it's not having JS as an extension language as opposed to Python (the only difference between ST and what I propose) that's making it difficult.
>Furthermore, is there even an actively maintained, open source, cross platform, development-focused text editor with native UI components?
There's a "cross platform, development-focused text editor with native UI component" that's working great.
Whether there's an open source editor like that is orthogonal, since what I'm discussing is whether is technically feasible to create such a browser -- and the existence of ST proves that it is (and that's by a single developer: with resources such as that GitHub or even better MS, have, it would be much easier).
The choice of license is just a decision after that.
>> "Sublime Text 2 is mostly coded in C++ and uses a custom UI toolkit." ... [0]
How many other devs/teams are going to reasonably take that on.
(And how do you think the debugging story of his custom framework compares to Chrome Devtools).
The minimap extension is made easy because they can just throw some HTML in a side pane, the image preview plugin just leverages the image displaying abilities of the browser, custom styling is as easy as throwing some CSS in a file, the extensions which let you preview the web page you are working on right in the browser use the full extent of the browser, the plugin that lets you easily preview markdown just uses a simple markdown->html converter then just displays the HTML/css. Themes are just a set of CSS which targets certain classes. Plugins can move, change, hide, show, do anything.
It also let's plugin authors do things the original developers never imagined possible. 3D object preview using webgl in a custom pane, replacing the whole implementation of tabs with something else, completely redesigning how the sidebar works and looks because it's all just HTML.
And while none of that can ONLY be done in a browser, the fact that a browser is the UI means that it's much easier, much quicker, and much more maintainable.
But in order to achieve an outcome such as: "an editor that's cross platform and is programmable in JS", using Electron and/or the DOM is not a necessary tradeoff at all.
This strikes me as a sort of devolving-human standpoint that might lead to someone in 2050 asking how anybody could possibly walk 10 miles unassisted.
In the past, small teams of talented developers have written an entire game + game engine + associated tools from scratch, countless times.
Doing in-depth custom UI development for the desktop as part of creating a text editor does not bin as 'Mountain-moving; Don't even try' difficulty.
Well, if you can only include "interchangeable languages" then it's not an observation but a tautology.
Have you seen a really seasoned vim user work? Purely from an efficiency point of view, vim/modal text editing is simply better than traditional text editors.
Even on the I/O heavy workloads that Node/V8 should be able to handle best, Java is ahead: https://www.techempower.com/benchmarks/
And yes, there are many Java apps that like to eat memory but I don't believe it's as bad or worse than V8/Electron and I don't believe Java is as inherently memory hungry as V8/Electron.
That being said, as someone who's used both Atom and IntelliJ a fair amount (although my daily driver is Vim), you can definitely see the downsides of using the JVM vs V8 in terms of startup cost. People complain about Atom being slow to start, but IntelliJ is so, so much worse — elsewhere in this thread dstaley mentioned it being almost 4x worse on a test file, and in large projects I've seen IntelliJ take literally minutes to begin being usable. The JVM is optimized for long-running server processes that can afford time to boot and warm up; the V8 team spends inordinate amounts of time ensuring that JS can begin executing quickly, even sometimes at the cost of peak performance. And RAM usage in IntelliJ isn't pretty either.
I don't think using the JVM instead of Electron buys much (if anything) in terms of editor performance compared to writing in native languages, like Rust or C++, and using native GUI toolkits instead of Swing/JavaFX or the DOM.
Try saying silly things on reddit and watch the hate flow in.
E.g. "most of algol-derived languages are quite similar, aside from small differences in syntax and feature set".
Or:
"Most modern mainstream languages, etc have pretty much similar feature sets and syntax (while still differing in being dynamic vs statically typed etc)"
That's not the same as what you said.