15 ms·
Migrating Slack's Desktop App to BrowserView
- nartz 9y agoI 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
- WorldMaker 9y agoI'm not sure that's the message here. The trade-offs in play aren't "custom bug fixes" but different approaches to a similar problem. In fact, the solution provided (BrowserView) is considered a better solution because it benefits from more "ordinary" browser bug fixes in Chromium and less overall custom work. (Every Chromium developer cares that Tabs work, not every Chromium developers works on or uses Chromium add-ons that make use of the <webview /> component.) Furthermore, BrowserView versus WebView isn't even necessarily a concern for every Electron application. It's used for embedding remote (read as web server hosted) web pages. In the Electron apps I've been building, 100% of the code is hosted locally, and I don't have a need to host outside webpages.
- nerpderp83 9y agoThis 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 9y agoElectron could still be faulty: its multi process architecture makes application developer easier to write memory leaking code.
- prashnts 9y agoQuick 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 9y agoIt depends on whether you're signed into multiple workspaces.
- acemarke 9y agoReally 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/master/store.md#synchronization https://github.com/markerikson/redux-ecosystem-links/blob/ma...
- saagarjha 9y agoThe 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 9y agoWhen 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!)
- wlesieutre 9y agoIf I’m not mistaken, the actual chat contents in Adium were rendered with web views, and its configurable message styling was done with HTML/CSS. The whole program wasn’t stuffed in the web view though, it was a presentation layer on top of a native backend. EDIT- here’s a source on that http://meyerweb.com/eric/thoughts/2005/12/19/adium-chatting-with-style/ http://meyerweb.com/eric/thoughts/2005/12/19/adium-chatting-...
- saagarjha 9y agoYes, this is what the native macOS Messages.app does as well. On my Mac, with relatively heavy usage, I'm at around 100 MB of RAM.
- forsaken 9y agoTried 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 9y agoHey, author here. :wave: If you don't mind doing Help > Report Issue it'll submit your logs and we can see what went down.
- mariusmg 9y agoSorry.
- dbbk 9y agoThere is nothing constructive nor mature about your comment.
- dang 9y agoYikes, you can't comment like this on Hacker News regardless of how bad a desktop app may be. We ban users who do this, so would you mind reading https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html and not doing it again? The idea for discussions on HN is: if you have a substantive point to make, make it thoughtfully; if you don't, then don't comment until you do. This isn't only about being nice, it's about preventing HN from becoming boring. Flamewars destroy forums. It wouldn't take many users posting like you did here for this site to quickly die. We all need to help to prevent that.
- randyrand 9y agoThere's no need to ban. Just put comments like these at the bottom under a "see more comments" button. Then we can accommodate more people.
- rrggrr 9y agoOn 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).
- adrianmonk 9y agoYeah, it's really wasteful of screen real estate. In a way that's worse than high RAM usage because I can spare 1GB of RAM if I really have to (and I can upgrade RAM easily enough if I can't spare it). But if an app takes up 1/4 to 1/3 of the width of my monitor, there's not much I can do to change that. Though at least there is a workaround: put it all the way to the right, then let other windows obscure the rarely-needed left portion of the Slack UI.
- M4v3R 9y agoI 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 9y agoI wish Slack has multi-window view, like many IRC clients.
- plopz 9y agoFollowing 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-7b40b4b493d5 https://blog.figma.com/introducing-browserview-for-electron-...
- gfodor 9y agoObviously 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 9y agoMore like moving from <iframe> to open in new browser tab and then working to position the new tab is if it were an <iframe>.
- deedubaya 9y agoI'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 9y agoSlack can take performance seriously and stick with Electron. That's certainly what this very article is about: big steps towards better performance.
- k__ 9y agoYes. Slack switching to something like Qt would (maybe) fix Slack, but then we would still have many slow Electron apps.
- raverbashing 9y agoI'd guess at this point, doing what Slack does would require a reimplementation of a web browser, with all the problems this would entail
- sidlls 9y agoWhy should they "take performance seriously?" They probably have a bunch of front end devs who are cheaper to pay and clearly there is support sufficient for them to raise large amounts of capital. I won't use the desktop app because I have standards. But apparently we're too few in number to matter. And from a business perspective there's nothing wrong with that. Frequently what engineers want and what makes (good business) sense are different.
- cakeface 9y agoI think that it's a trade off between features and performance. Are they going to add more customers by making Slack smaller and faster or by adding threaded conversations and other user features? Certainly stability is a requirement, and I see that in the changes they are talking about here. They could allocate a ton of engineers to platform native Slack implementations that would be fast as hell. But would they be able to ship a new feature like threaded conversations to all platforms quickly? What would be the cost? How would that change their presence in the marketplace. Everything is a trade off.
- brightball 9y agoAs 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 9y agoSame 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.
- wink 9y agoBut all the fancy stuff still doesn't work, it's mostly just fluff. (NB: I don't use VS Code or Atom and the Slack App on Linux has literally zero upsides for me vs a pinned desktop chrome bookmark or using nativefier, screenhero still misses features.)
- krisdol 9y agoSpotify, Slack, and Atom work fine for me, though slack is probably the most annoying one on all platforms. Atom is far from fluff in terms of functionality, but it's fine if you don't use it.
- wink 9y agothe fluff was obviously directed at slack and other "apps that are just bundled websites" - I see that an editor is something different (and I do use VS Code on Windows at times, but not very often)
- m_fayer 9y agoOh 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?
- cisanti 9y agoChrist, 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 9y agoIn 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
- callalex 9y agoI don’t want the UI to be consistent, I want it to be platform native.
- Drdrdrq 9y agoI am guessing you are not on Linux? Your priorities would be different then. For instance "similar in functionalities like on other OSs" is pretty high on my list.
- zeveb 9y agoI'm on Linux, and I want an XWindows-native UI. I want to be able to identify windows by their class. I want to be able to embed them. I want to be able to script them from the command line. I don't want something which is as weak & unusable as what I'd get on Windows or macOS.
- dmitriid 9y agoThat’s geek-speak. Most people don’t care about native/scriptability/embeddability. They want the same apps with the same functionality that the rest of the world uses.
- lwansbrough 9y agoWhat 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.
- duiker101 9y agoMaybe I'm missing something but doesn't TS compile to JS?
- fragmede 9y agoIt doesn't help that the Slack app is running in dev and not production mode - https://news.ycombinator.com/item?id=14899482 https://news.ycombinator.com/item?id=14899482
- tedmiston 9y agoSlack's response in the tweets indicates that they are not using the dev build but that the info is being reported incorrectly in the browser.
- berdon 9y agoTypeScript transpiles into some target JS version (ES5, ES6, ES2016, ES.Next). It is a different language but it gets executed as JS.
- allendoerfer 9y agoI think, that he was trying to say, Typescript feels like C#, so why not use the more performant option, if you use something similar but slower anyway.
- seba_dos1 9y agoSpending 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.
- akhatri_aus 9y agoUnicorn level startup. Still makes html based app.
- dictum 9y agoOn 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 9y agoI 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.
- dcgudeman 9y agoInteresting 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-observable-proposal-to-stage-2 http://tc39.github.io/tc39-notes/2017-05_may-25.html#17iiia-...
- codereflection 9y agoI 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 9y agoHipChat's being deprecated in the not to distant future in favor of Atlassian's Slack clone called "Stride".
- codereflection 9y agoNot according the the Atlassian folks. HipChat will live on, Stride is just replacing HipChat as their SaaS offering.
- iamatworknow 9y ago>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-stride-and-hipchat-cloud-937165565.html https://confluence.atlassian.com/stride-documentation/faq-st...
- sencho 9y agoHipChat Cloud ---> Stride. HipChat will live on as the behind the firewall solution for companies that do not want a pure SaaS app.
- djhworld 9y agoIs 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)
- hoodoof 9y agoHoly 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.
- iagooar 9y agoHow 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 9y agoThis is one of the highest priority items for the next quarter or two.
- therealmarv 9y agoI'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.
- mmgutz 9y agoFrom github electron The BrowserView API is currently experimental and may change or be removed in future Electron releases. Is it stable now?
- seanwilson 9y agoCan anyone summarise the difference between BrowserView and a Webview for Electron? I'm not getting the significance between them.
- aarpmcgee 9y agoDon't these guys have the resources to write native apps at this point?
- xenadu02 9y agoDead 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.
- dirtylowprofile 9y agoWire just released Teams. I believe also all of their apps are really really native.
- remir 9y agoI wonder if something like Flutter could end up replacing Electron eventually.
- swrobel 9y agoAnd here I got excited for a second and thought they were migrating to true native apps...
- pritambarhate 9y agoDoes 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.