How we're saving RAM in Dot Browser
Friday, May 29, 2020 ()
We use Electron. There, I said it.
We're not ashamed of using Electron and there are many reasons why we chose Electron and not just forked Chromium.
- Electron isn't a massive learning curve. C++ isn't friendly for beginners, and I've never touched C++ in my life.
- Electron gives you easy access to Web APIs. Web APIs are becoming more sophisticated and having a big set of tools ready to use is amazing.
- Electron gives you access to Node modules. Something like Axios or request works straight out the box in Electron.
So to the main question, how are we saving memory in Dot Browser?
Browsers like Chrome and Firefox separate UI components or dialog elements into their own processes, for example: the suggestion box is one process and the alert boxes are another process.
Now, that isn't very efficient, each of those processes add to the total memory usage and ends up in a massive mess of tabs and dialogs.
So we're working on a solution to this issue. If we have a parent dialog (imagine it like a house) and inside we have all the child dialogs. The parent dialog would be like an overlay, and it covers the whole browser view with an invisible layer. And when the browser decides one of the children has to be shown to the user, it just toggles it on and it displays on the overlay.
The rest of the browser is still usable while the overlay is over the top of everything, buttons work, input boxes work, everything.
In conclusion, having one overlay or parent dialog rather than 15 dialogs with each UI element, improves memory usage as there is only one dialog.
We hope this gives you an insight into how we're improving performance in Dot Browser.