
Migrating Slack's Desktop App to BrowserView - manigandham
https://slack.engineering/growing-pains-migrating-slacks-desktop-app-to-browserview-2759690d9c7b
======
lwansbrough
What the hell is taking up all that RAM? Slack is using over 800MB of RAM on
my computer right now, and it's completely idle. I've got a C# process on my
computer right now handling thousands of messages _per second_ and consuming
1/20th the RAM. If you rebuild Slack in Xamarin you'd probably drop your RAM
consumption to under 50MB, just a guess. JS fiends are gonna tell me C# ain't
JS, and I agree. TypeScript ain't JS either, and it's a hell of a lot closer
to C# than it is JS.

I'm a big JS guy, believe me, but I wouldn't call a chat app using "only"
800MB of RAM a "win." Sorry to the guys who worked hard on this.

~~~
petemill
Even if it was done in Xamarin, you'd still need some kind of web client /
browser to fetch and render the actual slack workspaces

~~~
ivm
Why use web at all? IRC clients have been made with native UIs since the 90s.

~~~
chrisco255
Harder to work with than CSS. Harder to align look of web and desktop.

~~~
flukus
> Harder to align look of web and desktop

This is what I don't want, I want it to look like every other desktop app, I
want to be able to set the theme of my OS and have every app adopt it, I don't
want every piece of software thinking it's special and looking different.

> Harder to work with than CSS.

What native technologies have you used? Many are easier than css+html and look
native by default.

~~~
Spivak
It will happen when companies stop being rewarded for branding, which is to
say never.

------
brightball
As a Linux laptop user, I fully endorse Electron. There’s so much more
available for Linux because of it that would have no client at all otherwise.

Between NVMe disks and the ability to have 64gb of RAM if I want...keep it
coming. I’d rather have heavy software than no software.

~~~
SteveNuts
Same here, it's really nice to have VSCode, atom, slack, etc.

RAM is pretty cheap, I'd rather put money towards a better Linux machine than
give that money to Microsoft for the OS.

~~~
m_fayer
Oh what a lovely cycle. Every dev knows 16gb is the new 8gb so sure, why not
have every desktop app consist of 20 independent webview/node processes. Can't
wait until 32gb is the new 16gb.

Eventually, when every single desktop app is like this, and we can no longer
keep shoving more RAM into computers, we'll realise that the only way to
manage such hogs is to pickle background apps to disk Android-style and to
just have one foreground app in memory. And that's when we'll all realise we
might as well switch to Chrome OS. Well played, web devs, Google says thanks.

Or maybe Electron is a conspiracy by someone heavily invested in RAM
production?

~~~
xwvvvvwx
32 is already the new 16.

~~~
yellowapple
That's horrifying.

~~~
xwvvvvwx
That's progress.

~~~
flukus
That's regression. Despite having vastly more memory than 20 years ago I'm not
getting anything more done with it.

~~~
trashcan
What OS were you using in 1997? I believe I was using Windows 95 then and was
definitely getting a lot less done with it.

------
saagarjha
The screenshot shown in the article shows Slack using well over 600 MB of RAM.
I'm not sure I find this acceptable for a chat app with four "tabs" open.

~~~
afandian
When these kinds of things come up there's often complaint that desktop apps
running in the browser are inefficient. As it happens, I agree. An old
favourite of mine, Adium, probably never used 600 MB because I'm pretty sure
my PowerBook G4 had less RAM than that.

But I think it's a mistake to jump to the conclusion that these apps should be
written in a native framework rather than a web view. Slack is doing much more
than Adium: web previews, document previews, pulling in pre-rendered fragments
from the server and modular stylesheets. I wonder how much RAM Adium would
have used to do the same things, and I wonder how much time the developers of
an equivalent cross-platform app would have spent if they had been split
trying to optimise lots of different platforms. They would essentially be re-
inventing a modular layout and rendering engine (aka a web browser).

I don't know what the answer is. Maybe the detractors would prefer that the
app did less. I know I'd prefer not to have previews and emojis, but I'm sure
my colleagues find them useful.

(EDIT: Per reply below, turns out Adium did use a web view for presentation!)

~~~
amedvednikov
That's why I'm developing eul, a lightweight native desktop client for Slack,
Skype, Facebook etc:

[https://eul.im](https://eul.im)

It's only 4 MB and handles tens of thousands of Slack messages in one chat
without lag.

1.0 release is going to be out in early November.

~~~
tstieff
One thing that concerns me about any 3rd party chat application is that it's
difficult to know if my data is secure. Any thoughts on open sourcing your
application?

~~~
amedvednikov
Yes! I want to make it open source, from my experience that's the best option
for all parties. Unfortunately it won't be possible to open source some parts
of the app.

I'm setting up a company right now to increase trustworthiness. Like the home
page says, no data will ever be shared with anyone and soon it will be
possible to verify this.

~~~
criddell
> Unfortunately it won't be possible to open source some parts of the app.

Why is that? Are you licensing code from somebody else?

------
cisanti
Christ, so many buzzwords and frameworks and rewrites but all users ask for is
a damn chat application with few tabs.

Either I'm getting old and grumpy, or it used to be possible in the year 2000
without your computer fans taking off and 1gb of ram.

~~~
dmitriid
In year 2000 you might only have to care about Win98. And that’s it.

In 2017 there’s no tech stack that lets you write consistent UIs across
multiple platforms. Except, unsurprisingly, Electron

~~~
vlunkr
[https://news.ycombinator.com/item?id=14066784](https://news.ycombinator.com/item?id=14066784).
Here's a discussion on alternatives. It's really not the only choice.

~~~
jm547ster
It has become the default in enterprise settings, which can’t swap solutions
out quite so easily

------
deedubaya
I'm a proponent of Electron for startups just getting off the ground with
cross-platform desktop apps.

Slack has raised some serious capital, however. The desktop app is the
cornerstone of their product and performance is a known pain point
(cpu/memory). Why haven't they left electron in the dust and taken performance
seriously?

~~~
WorldMaker
Slack can take performance seriously _and_ stick with Electron. That's
certainly what this very article is about: big steps towards better
performance.

~~~
k__
Yes.

Slack switching to something like Qt would (maybe) fix Slack, but then we
would still have many slow Electron apps.

------
seba_dos1
Spending time on problems you wouldn't have to solve if you would choose your
tools more carefully instead of following fads, and still coming up with
something very far from optimal.

That would be awesome post if it was made as an experiment, to test the limits
of Electron, to learn and let others learn, to just play with BrowserView. But
seeing this as a technical write-up about one of the very popular chat apps
used out there, it's just sad and wasteful.

------
iagooar
How about improving boot time? Nobody talks about it, but since Slack uses so
much RAM, I like to close it from time to time and open it when I feel like
getting distracted.

But then, it takes 30 seconds (!) from opening the application to being able
to type the first message. There is no other app on my MBP that needs so long,
and we're talking pretty new hardware with SSD and an i7.

Sorry, but I don't care about your portability across different platforms, I
just can't. I want the best experience on mine.

~~~
CharlieHess
This is one of the highest priority items for the next quarter or two.

------
rrggrr
On a related note, for an app I have open all day long but interact with on an
event-driven basis - Slack's UI is just too darn big. I miss the days when the
only chat UI was a small column (eg. ICQ).

~~~
M4v3R
I think Slack tries to mimic IRC more than ICQ, and all IRC clients I know had
big windows, because they assumed you want to see what's happening on the
channel at all times.

~~~
forgot-my-pw
I wish Slack has multi-window view, like many IRC clients.

------
dictum
On macOS, web app wrappers created with Fluid
([http://fluidapp.com](http://fluidapp.com)) consistently use less resources
than the official Electron-based versions, in my experience.

It's a wrapper for the system-supplied Webkit, so it inherits those benefits
from that. I've been experiencing a similar performance to Chrome in Safari
11, but lower RAM/CPU/GPU usage overall.

~~~
mikewhy
I used Fluid, now use MacPin. Apps are much smaller, essentially just the size
of their JS bundles. But then you're back to cross-browser woes and no native
layer.

------
acemarke
Really neat to see how Redux's design and extensibility make this kind of
action serialization and store synchronization possible. There was another
similar example recently where someone was synchronizing multiplayer game
states via Redux actions [0]. There's actually quite a few addons available
related to store synchronization [1].

[0] [http://jimpurbrick.com/2017/01/04/vr-
redux/](http://jimpurbrick.com/2017/01/04/vr-redux/) ,
[http://jimpurbrick.com/2017/07/04/react-vr-redux-
revisited/](http://jimpurbrick.com/2017/07/04/react-vr-redux-revisited/)

[1] [https://github.com/markerikson/redux-ecosystem-
links/blob/ma...](https://github.com/markerikson/redux-ecosystem-
links/blob/master/store.md#synchronization)

------
nartz
I think this article is really helpful when deciding to use a nascent
technology (Electron) in production- pretty cool you can create a desktop app
with javascript, but at the same time, expect to do a lot of custom bug fixing
and hope that there aren't issues in the core code (note: there always are) =D

~~~
nerpderp83
This isn't Electron's fault. This is slacks fault. Look at the memory
footprint of VS Code opening hundreds of files. A much much more substantial
application than slack that uses a small fraction of the memory. On my
machine, VS code with hundreds of open files is using just over 200MB.

~~~
jsnar
Electron could still be faulty: its multi process architecture makes
application developer easier to write memory leaking code.

------
plopz
Following a link in the article led me to this nice quote[0] "The trade-off is
that positioning and layering BrowserViews is trickier because you can no
longer use the normal HTML and CSS positioning and layering primitives like
you can with a webview. You have to manually layout BrowserViews and make sure
that it is layered properly."

So to make electron less of a hog, you ditch the web part?

[0] [https://blog.figma.com/introducing-browserview-for-
electron-...](https://blog.figma.com/introducing-browserview-for-
electron-7b40b4b493d5)

~~~
gfodor
Obviously not, clearly the point mentioned just has to do with the macro
layout of one or more browser frames. It sounds like they moved from a model
like <iframe> to <frameset>

~~~
WorldMaker
More like moving from <iframe> to open in new browser tab and then working to
position the new tab is if it were an <iframe>.

------
akhatri_aus
Unicorn level startup. Still makes html based app.

------
xenadu02
Dead Slack:

Stop being lazy. You’re not a scrappy startup anymore. Build real native apps
for each platform.

Using electron solves your problem. As a user it sure as hell doesn’t solve
any problem I have.

------
therealmarv
I'm sure this will not fix my 25% cpu core burn on open gifs. Slack is no. 1
reason for my laptop to spin up fans because I left it open with a gif from
giphy.

------
forsaken
Tried the new beta: it lost all my configured networks, and I had to re-add
them all. Otherwise, it seems _way_ faster than the old one, and definitely an
upgrade.

~~~
CharlieHess
Hey, author here. :wave: If you don't mind doing Help > Report Issue it'll
submit your logs and we can see what went down.

------
hoodoof
Holy heck is there really no more simple architecture for this app?

Even the TLDR at the bottom didn't succinctly explain the advantage of
browserview over the old way.

------
codereflection
I am wishing that the devs on the HipChat desktop apps are paying close
attention to this. The Slack desktop app has been a resource hog, but nothing
compared to the HipChat desktop app. (All anecdotal evidence)

~~~
iamatworknow
HipChat's being deprecated in the not to distant future in favor of
Atlassian's Slack clone called "Stride".

~~~
codereflection
Not according the the Atlassian folks. HipChat will live on, Stride is just
replacing HipChat as their SaaS offering.

~~~
iamatworknow
>Do you plan to sunset HipChat Cloud?

>For now, HipChat Cloud will continue to be supported, but eventually we will
encourage all HipChat Cloud customers to upgrade to Stride.

This seems like business speak for "get converted to Stride sooner rather than
later because HipChat won't be around for much longer".

[https://confluence.atlassian.com/stride-documentation/faq-
st...](https://confluence.atlassian.com/stride-documentation/faq-stride-and-
hipchat-cloud-937165565.html)

~~~
sencho
HipChat Cloud ---> Stride.

HipChat will live on as the behind the firewall solution for companies that do
not want a pure SaaS app.

------
dcgudeman
Interesting to read Slack proselytize the use of Observables (which I'm a huge
fan of). I really wish TC39 would move it to stage two. I found the following
discussion/ reasoning pretty lacking for the amount of use Observables are
getting.

[http://tc39.github.io/tc39-notes/2017-05_may-25.html#17iiia-...](http://tc39.github.io/tc39-notes/2017-05_may-25.html#17iiia-
observable-proposal-to-stage-2)

------
mmgutz
From github electron

    
    
        The BrowserView API is currently experimental and may change or be removed in future Electron releases.
    

Is it stable now?

------
pritambarhate
Does Slack use WebRTC for it's call and screen sharing features? If yes, that
might be one of the main reasons why it is written with Electron. It's very
very hard to find people who can actually handle WebRTC C++ stack. On the
contrary, Chrome has one of the best WebRTC support and screen sharing works
out of the box.

------
djhworld
Is anyone else getting chat service fatigue?

Looking at my dock I have Discord, Slack, Textual (IRC), WhatsApp Web open.

I wish there was a service that just amalgamated all these together into one
thing, with a rough set of common features (e.g. ability to post
images/gifs/videos, text etc)

~~~
Crespyl
If it doesn't exist yet, I'm sure someone will be along shortly to re-invent
Trillian or Pidgin as an Electron app.

------
aarpmcgee
Don't these guys have the resources to write native apps at this point?

------
prashnts
Quick question -- in screenshots for macos version there's no "titlebar"
(kinda like a HUD window) but both beta and stable on my system show the
titlebar. Is there anything different there?

~~~
acdx
It depends on whether you're signed into multiple workspaces.

------
seanwilson
Can anyone summarise the difference between BrowserView and a Webview for
Electron? I'm not getting the significance between them.

------
swrobel
And here I got excited for a second and thought they were migrating to true
native apps...

------
dirtylowprofile
Wire just released Teams. I believe also all of their apps are really really
native.

------
remir
I wonder if something like Flutter could end up replacing Electron eventually.

