Live data from Hacker News

Our Quest for Faster Boot Times and Offline Support

slack.engineering

41–50 of 57 posts

Re: Our Quest for Faster Boot Times and Offline Support

#41
post #39

Earlier quoted context omitted.

It seems to me that the reason this architecture is needed is because the original choice of technology necessitates it. I mean, it's not that a C++ application wouldn't need a rearchitecting for startup performance, but it would likely not be needed for an application as simple as Slack.

I’m curious: why would you consider Slack to be “simple”? I see Slack as an incredibly full-featured app. As always, many people might not use all the features, but that doesn't mean that nobody does…

I'm comparing it to applications that may have somewhat more reasons for slow startup times, like mentioned below in the thread (think: Photoshop, Maya, Unreal Engine, etc). Not a chat application.

I'm not saying Slack is not full-featured, but it's definitely not on the same scale as some of these other applications.

Re: Our Quest for Faster Boot Times and Offline Support

#42
post #33

> However, a typical Slack customer may boot just once each morning and could find themselves perpetually a full day’s worth of releases behind (we release new code multiple times a day). > […] > We still want users on the latest possible version so they receive the most up-to-date bug fixes, performance improvements, and feature roll outs. Soon after we released the new client, we added registration on a jittered in…

Multiple releases a day? How is that reasonable?

Re: Our Quest for Faster Boot Times and Offline Support

#43
post #39

Earlier quoted context omitted.

I’m curious: why would you consider Slack to be “simple”? I see Slack as an incredibly full-featured app. As always, many people might not use all the features, but that doesn't mean that nobody does…

I'm comparing it to applications that may have somewhat more reasons for slow startup times, like mentioned below in the thread (think: Photoshop, Maya, Unreal Engine, etc). Not a chat application. I'm not saying Slack is not full-featured, but it's definitely not on the same scale as some of these other applications.

Maybe, but I would actually argue with the assumption that an image editor is somehow inherently (allowed to be) “more complicated and/or slow” than a productivity app.

Or, more simply: Slack (and other similar products) are not just “chat applications”.

Re: Our Quest for Faster Boot Times and Offline Support

#44

The amount of time and money pushed into basically creating a JS version of QT, we could have had a native client, that isn't workaround bloat?

How far will people go to avoid learning C++? Trust me, C++ isn't that scary.

That was my experience creating a small Qt web site archiver/spidering tool. Most of my experience is in Rust, and it was easier to learn a little bit of C++ than it was to try and figure out the binding generators required to avoid C++.

Re: Our Quest for Faster Boot Times and Offline Support

#45
post #43

Earlier quoted context omitted.

I'm comparing it to applications that may have somewhat more reasons for slow startup times, like mentioned below in the thread (think: Photoshop, Maya, Unreal Engine, etc). Not a chat application. I'm not saying Slack is not full-featured, but it's definitely not on the same scale as some of these other applications.

Maybe, but I would actually argue with the assumption that an image editor is somehow inherently (allowed to be) “more complicated and/or slow” than a productivity app. Or, more simply: Slack (and other similar products) are not just “chat applications”.

No, they're certainly not just chat applications, but if you think that Photoshop is an image editor that is somehow at the same level of complexity as Slack I'm not sure what to tell you. We'll have to agree to disagree!

Re: Our Quest for Faster Boot Times and Offline Support

#46
I would like to debunk some myths around electron (chromium performance) vs "native" performance.

If we talk about desktop, native means everything and nothing. Originally native means the GUI(s) that are shipped by default on an OS. There are also cross platforms GUI(s) like QT or GTK, they're not native and native is not an intrinsic quality per se it's a limitation (not being cross platform) and one could say it is better "integrated on the OS" but in practice that doesn't mean a lot (actually people are far more used to web UX than the native default UX (which is inconsistent between their own devices (Android vs windows mainly)))

The default GUI themes from e.g GTK are not flexible enough and modern enough for a startup.

So let's compare GUI(s) that allow customizing UX Let's debunk the performance myth: Native or cross platforms GUI(s) are less performant than chromium/electron on a number of metrics The most user facing performance metric is rendering performance. GTK use Cairo, QT has it's own renderer, many smaller native GUI(s) use worse or equal renderer. Chromium develop and use Skia (tuned for the needs of chromium) Skia is by far the fastest, mature 2D renderer (but I have hope in a fastuidraw backend from Intel), GTK and QT renderers are often ridiculously slower. Rendering performance is not only tied by that. Vsynctester.com show that chromium has great support for low, consistent latencies. QT and GTK have not the human resources nor the expertise to have such a quality assurance and performance. Hardware makers contribute to chromium, e.g the state of the art NV_path support if you have an Nvidia card. GUI(s) cannot afford this. Every potential bottleneck in chromium is decoupled, they parallelize (+ AVX) and make asynchronous almost everything. They have state of the art scrolling performance. State of the art networking performance (and will be the firsts to support HTTP3 (for September) Chromium will in a few releases render every websites using Vulkan API, no GUI toolkit can catch up. They are also totally rewriting their layout engine to learn from past mistakes. Microsoft is moving chromium input handling off the main thread to reduce input latency. Web apis allow performance control (e.g css containment) and profiling far beyond native apis (but most don't know about them)

So if chromium has the fastest rendering, scrolling, input handling and networking performance, why do people think that electron apps are "slow" or "bloated"

It depends what we talk about: If we talk about Langage performance, yes c++ destroy JS. WebAssembly help but does not catch-up. But electron or CEF allow to use c++ just fine so this point is moot.

Indeed people won't observe lag on native guis when such guis have e.g gnome theme where everything is monochrome, there's no complex rendering, no animation, no responsive layout, etc. If you watched the slack GUI on Gtk I believe it would lag, but actually GTK has not enough features to recreate slack.

Let's talk about RAM usage: Not using available RAM is a failure not a reason to be proud... RAM allow preemption / caching instead of recomputing the same thing over and over. So if you want to compare chromium vs a GUI toolkit efficiency: compare the same UX, and look at cpu usage too.

Let's talk about disk usage: Yes it's dumb to download a browser for each app... It's not a big problem seeing current disk space, and is solved by Google Carlo. Electron has a prototype for solving this issue too. Using Carlo, web apps will use less disk space that most other GUI toolkits!

Another potential reason for the misunderstanding come from the usual gap of skill between say a QT dev and an electron dev. Generally the QT dev (c++) has a mindset more oriented for performance, optimizations. This is cultural, the same person could optimize for electron.

The last reason could have been a valid one: Chromium transcend any other GUI toolkit feature wise which allow startups to express most design, in a precise, productive way. This has the theoretical downside of having more complex designs, and more constraints on possible optimizations. E.g a layout engine cannot make the same Invariant assumptions if it has to handle Right to left text (RTL). If there was as much dev improving QT there is on chromium, I have no doubt QT would have better performance because of more possible optimizations because of less features.

But the reality is, this is far outweighted. I would like to introduce the important notion of software poverty. What I mean by software poverty is a software that has a slow development. It's relative, and comparing QT or GTK to chromium is like comparing USA to Zimbabwe. Gui(s)often have a few 10K commits while chromium has 850000 commits. This is order of magnitudes differences! Numbers have not a strong effect on the brain but they should. The gap will increase even more now that Microsoft joined chromium.

To partially survive, GUI(s) toolkits like GTK or QT, webify! GTK styling is now made with css via an old webkit... QT QML and styling (modern QT) is made through the QT web engine (an old chromium).

Finally it is true that electron is not latest chromium, but it's "quickly" catching up, and many issues attributed to an electron app are due to it being an old electron, so using an old browser (and yes browsers are awesome since not that many years)

BTW skia is becoming the default renderer in android 10.

I guess I debunked many myths, any feedback?

Re: Our Quest for Faster Boot Times and Offline Support

#47
I can write a long list of reasons why Electron is bad for performance.

Having read this blog post though, I can see none of those reasons apply to Slack.

The kind of performance optimizations that they're calling "a radically reimagined desktop client architecture," are actually basic engineering practices that apply equally to all development platforms.

> Using a CDN-cached HTML file, a persisted Redux store, and a Service Worker, we were able to boot a stripped-down version of the client in less than a second

None of these are specific to the browser or Electron. For example:

> a CDN-cached HTML file

Assuming the HTML file simply points to the styles and the scripts (i.e. no content-related markup), I am surprised that they weren't already caching it on the client and the server. Without caching the HTML file, upon boot, everything has to wait until a meaningful chunk of that file is loaded.

What happens in a regular native setup is that what functions as that minimal HTML file is already bundled into the app's package and is always read from disk.

> a persisted Redux store

There is nothing radical about this. Storing part of the application state on disk and re-hydrating upon reload is standard practice. And again, not specific to the browser or Electron. On iOS (and I'm sure on Android), models can be decorated with a persist/re-hydration mechanism. In fact, having this redux-style single-source-of-truth state object makes it even easier to serialize the state to disk and read it back.

In fact, not a single optimization mentioned in the article is specific to the browser or Electron. Slack is not slow because of Electron. Slack is slow because of Slack. They could've written it in assembly, and without these basic optimizations, it wouldn't have run much faster.

ps. I'm not trying to bash on the engineering team though. I'm certain they had other priorities, being a hyper growth startup and all. I cannot say that I would've done differently under those same constraints.

Re: Our Quest for Faster Boot Times and Offline Support

#48

I would like to debunk some myths around electron (chromium performance) vs "native" performance. If we talk about desktop, native means everything and nothing. Originally native means the GUI(s) that are shipped by default on an OS. There are also cross platforms GUI(s) like QT or GTK, they're not native and native is not an intrinsic quality per se it's a limitation (not being cross platform) and one could say it i…

> Let's talk about RAM usage: Not using available RAM is a failure not a reason to be proud...

That is rather disingenuous. People aren't complaining about using RAM at all, they are complaining about using it inefficiently compared to other options. Your statement makes it sound like using more RAM is in itself a source of pride. Many of your other points are perfectly valid, but they are overshadowed a bit by that rather silly one.

Re: Our Quest for Faster Boot Times and Offline Support

#49

I would like to debunk some myths around electron (chromium performance) vs "native" performance. If we talk about desktop, native means everything and nothing. Originally native means the GUI(s) that are shipped by default on an OS. There are also cross platforms GUI(s) like QT or GTK, they're not native and native is not an intrinsic quality per se it's a limitation (not being cross platform) and one could say it i…

> Let's talk about RAM usage: Not using available RAM is a failure not a reason to be proud... That is rather disingenuous. People aren't complaining about using RAM at all, they are complaining about using it inefficiently compared to other options. Your statement makes it sound like using more RAM is in itself a source of pride. Many of your other points are perfectly valid, but they are overshadowed a bit by that…

>Many of your other points are perfectly valid, but they are overshadowed a bit by that rather silly one

Thank you.

>they are complaining about using it inefficiently compared to other options

I cannot deny nor confirm that, where is the evidence? For an equivalent UX?

Re: Our Quest for Faster Boot Times and Offline Support

#50

Earlier quoted context omitted.

> Let's talk about RAM usage: Not using available RAM is a failure not a reason to be proud... That is rather disingenuous. People aren't complaining about using RAM at all, they are complaining about using it inefficiently compared to other options. Your statement makes it sound like using more RAM is in itself a source of pride. Many of your other points are perfectly valid, but they are overshadowed a bit by that…

> Many of your other points are perfectly valid, but they are overshadowed a bit by that rather silly one Thank you. > they are complaining about using it inefficiently compared to other options I cannot deny nor confirm that, where is the evidence? For an equivalent UX?

> where is the evidence

Evidence of people stating that Electron apps use RAM inefficiently compared to how they believe "more native" implementations would? All over the place.

Of people giving specific examples? No time to search one out right now but I've seen many discussions where similar tools written in different frameworks show Node+Chrome+YourCode to use much more memory than the others, sometimes with a less responsive feeling UX, while providing a very similar feature set, so that evidence should be easy to find.

Do you have any evidence of your opposing theory? Applications with the same feature set where an Electron based version has similar (or, indeed, lower) memory requirements for similarly performant operation / UX, or a situation where an Electron based tool manages to provide more functionality with the same memory requirements?

Post reply on HN