SlideShare a Scribd company logo
Electron Performance
and C++ in Mailspring
(or: what I’ve been up to for the last six months!)
Me
• Mac & iOS ➡ React & Electron
• Run a small team doing React /
mobile dev, now working on
Mailspring.
• Led the team building Nylas
Mail from 2014–2016.
Nylas Mail ➡ Mailspring
• May 2017: Nylas API business booming—engineers
pulled from Nylas Mail to fight growth fires!
• Sept 2017: Nylas Mail officially sunset, re-licensed
under MIT. 🎉
Mailspring: Fix longstanding issues, use Pro version
revenue to run service and pay core contributors.
☄
Complaints about Nylas Mail
• Long startup time
• High battery impact
• Uses too much RAM*
Electron
😡 😤🚀🔥
• Long startup time
• High battery impact
• Uses too much RAM*
👷(
Complaints about Nylas Mail
Electron
Reducing startup time
• Start loading a BrowserWindow as fast as possible
• Watch out for sync I/O in main process
• Use the ASAR format in production
• Load less JavaScript (on launch)
🕵
Your Code
Your node_modules
Heavy Node Modules
Heavy Node Modules
Heavy Node Modules
Heavy Node Modules
Heavy Node Modules
1.7MB of JSON
😱
Devtron
• Easy to find heavy dependencies and see total JS
loaded.
• `request` is 910k of JS. Can you use Fetch APIs?

`bluebird` is 180k of JS. Can you use native Promise?
Nylas Mail
Devtron
Mailspring
• Easy to find heavy dependencies and see total JS
loaded.
• `request` is 910k of JS. Can you use Fetch APIs?

`bluebird` is 180k of JS. Can you use native Promise?
Devtron
• Some things you can’t avoid… but you can load
later. Who needs spellcheck in the first 500ms?
More UI Plugins SpellcheckerCore Window
Interactive in 1.0s
Energy Impact
Sync all mail, restart Mac, hide
applications, wait 15 minutes
Reducing Energy Impact
• Check for animations / needless layout
• Minimize use of setTimeout, setInterval. Don’t
wake and perform work if you don’t need to.
• Attach an event listener to `blur` that toggles
a CSS class, use it to prevent animations.
Checking for Animations
Checking for Animations
Loading indicator with opacity: 0 animating forever!
setTimeout / setInterval
• Use smarter polling strategies:
• Change polling rate based on Electron
PowerMonitor state.
• Poll when important events occur (window
focus event) rather than all the time.
But… what if it’s not enough?
• Need to sync mail every few minutes,
sometimes this requires polling.
• Need to keep IDLE connections open
to mail providers.
• Need to keep streaming connection
open to Mailspring server.
👷(😭 😢
Architecture
Observable SQLite Database
(electron-rxdb)
Architecture
C++
Enter C++
• Command line C++ processes replace the
background “work” window.
• Read actions on stdin, write JSON event
stream to stdout.
• Main window spawns these processes, binds to
their stdio streams, and re-broadcasts events.
C++ tradeoffs
• In JavaScript, control flow is hard.

(Promises, async/await, etc.)
• In C++, control flow is easy but memory is hard.
(Sync I/O on a few threads.)
• The SQLite bindings for C are incredibly fast.
• Shipping C++ cross-platform is hard.
C++ is kind of… pretty?
• The C++11 syntax is really elegant.
• Modern features like condition_variable allow
the sync engine to do almost no polling.
Energy Impact
✨
Memory Use
805MB 368MB
MailspringNylas Mail
Takeaways
• Keep your dependencies light, use built-in APIs
when possible. Check require tree with Devtron!
• Use “Paint Flashing” to identify crippling CSS /
layout issues. Minimize timer use if possible.
• Combining Electron and C++ (or Haskell, or Go,
etc.) isn’t that crazy.
Thanks!
getmailspring.com
@bengotow

More Related Content

What's hot

NLUUG print conference May 26 2016
NLUUG print conference May 26 2016NLUUG print conference May 26 2016
NLUUG print conference May 26 2016
Igmar Palsenberg
 
Testing in Infrastructure
Testing in InfrastructureTesting in Infrastructure
Testing in Infrastructure
Muhammet Arslan
 
The challenges of live events scalability
The challenges of live events scalabilityThe challenges of live events scalability
The challenges of live events scalability
Guy Tomer
 
Spotify's Music Recommendations Lambda Architecture
Spotify's Music Recommendations Lambda ArchitectureSpotify's Music Recommendations Lambda Architecture
Spotify's Music Recommendations Lambda Architecture
Esh Vckay
 
AWS Customer Presentation-MyTaxi
AWS Customer Presentation-MyTaxiAWS Customer Presentation-MyTaxi
AWS Customer Presentation-MyTaxi
Amazon Web Services
 
Denver AWS Users' Group Meeting - July 2018 Slides
Denver AWS Users' Group Meeting - July 2018 SlidesDenver AWS Users' Group Meeting - July 2018 Slides
Denver AWS Users' Group Meeting - July 2018 Slides
David McDaniel
 
What's new in FME 2019: FME Server
What's new in FME 2019: FME ServerWhat's new in FME 2019: FME Server
What's new in FME 2019: FME Server
GIM_nv
 
Monitoring the unknown, 1000*100 series a day - Big Data Vilnius 2017
Monitoring the unknown, 1000*100 series a day - Big Data Vilnius 2017Monitoring the unknown, 1000*100 series a day - Big Data Vilnius 2017
Monitoring the unknown, 1000*100 series a day - Big Data Vilnius 2017
Quentin Adam
 
JUST EAT: Tools we use to enable our culture
JUST EAT: Tools we use to enable our cultureJUST EAT: Tools we use to enable our culture
JUST EAT: Tools we use to enable our culture
Peter Mounce
 
Async js
Async jsAsync js
Tavernalc: How to transform your OpenOffice Calc into a grid.
Tavernalc: How to transform your OpenOffice Calc into a grid.Tavernalc: How to transform your OpenOffice Calc into a grid.
Tavernalc: How to transform your OpenOffice Calc into a grid.
Alexandro Colorado
 
Promise of a better future by Rahul Goma Phulore and Pooja Akshantal, Thought...
Promise of a better future by Rahul Goma Phulore and Pooja Akshantal, Thought...Promise of a better future by Rahul Goma Phulore and Pooja Akshantal, Thought...
Promise of a better future by Rahul Goma Phulore and Pooja Akshantal, Thought...
Thoughtworks
 
Technology | Serverless
Technology | ServerlessTechnology | Serverless
Technology | Serverless
Ani Sinanaj
 
What we learned from the AWS Outage
What we learned from the AWS OutageWhat we learned from the AWS Outage
What we learned from the AWS Outage
PolarSeven Pty Ltd
 
AWS meetup: Containers@iZettle
AWS meetup: Containers@iZettleAWS meetup: Containers@iZettle
AWS meetup: Containers@iZettle
Alberto Lorente Leal
 
What's new in FME 2019: FME Desktop
What's new in FME 2019: FME DesktopWhat's new in FME 2019: FME Desktop
What's new in FME 2019: FME Desktop
GIM_nv
 
Charles_Qian_Resume
Charles_Qian_ResumeCharles_Qian_Resume
Charles_Qian_Resume
Charles Qian
 
Quarterly Technology Briefing, Manchester, UK September 2013
Quarterly Technology Briefing, Manchester, UK September 2013Quarterly Technology Briefing, Manchester, UK September 2013
Quarterly Technology Briefing, Manchester, UK September 2013
Thoughtworks
 
GreenButton-201502
GreenButton-201502GreenButton-201502
GreenButton-201502
Jonathan Kalbfeld, MBA
 
3D Slideshow Transitions: Adding OpenGL-Accelerated Transitional Effects For ...
3D Slideshow Transitions: Adding OpenGL-Accelerated Transitional Effects For ...3D Slideshow Transitions: Adding OpenGL-Accelerated Transitional Effects For ...
3D Slideshow Transitions: Adding OpenGL-Accelerated Transitional Effects For ...
Alexandro Colorado
 

What's hot (20)

NLUUG print conference May 26 2016
NLUUG print conference May 26 2016NLUUG print conference May 26 2016
NLUUG print conference May 26 2016
 
Testing in Infrastructure
Testing in InfrastructureTesting in Infrastructure
Testing in Infrastructure
 
The challenges of live events scalability
The challenges of live events scalabilityThe challenges of live events scalability
The challenges of live events scalability
 
Spotify's Music Recommendations Lambda Architecture
Spotify's Music Recommendations Lambda ArchitectureSpotify's Music Recommendations Lambda Architecture
Spotify's Music Recommendations Lambda Architecture
 
AWS Customer Presentation-MyTaxi
AWS Customer Presentation-MyTaxiAWS Customer Presentation-MyTaxi
AWS Customer Presentation-MyTaxi
 
Denver AWS Users' Group Meeting - July 2018 Slides
Denver AWS Users' Group Meeting - July 2018 SlidesDenver AWS Users' Group Meeting - July 2018 Slides
Denver AWS Users' Group Meeting - July 2018 Slides
 
What's new in FME 2019: FME Server
What's new in FME 2019: FME ServerWhat's new in FME 2019: FME Server
What's new in FME 2019: FME Server
 
Monitoring the unknown, 1000*100 series a day - Big Data Vilnius 2017
Monitoring the unknown, 1000*100 series a day - Big Data Vilnius 2017Monitoring the unknown, 1000*100 series a day - Big Data Vilnius 2017
Monitoring the unknown, 1000*100 series a day - Big Data Vilnius 2017
 
JUST EAT: Tools we use to enable our culture
JUST EAT: Tools we use to enable our cultureJUST EAT: Tools we use to enable our culture
JUST EAT: Tools we use to enable our culture
 
Async js
Async jsAsync js
Async js
 
Tavernalc: How to transform your OpenOffice Calc into a grid.
Tavernalc: How to transform your OpenOffice Calc into a grid.Tavernalc: How to transform your OpenOffice Calc into a grid.
Tavernalc: How to transform your OpenOffice Calc into a grid.
 
Promise of a better future by Rahul Goma Phulore and Pooja Akshantal, Thought...
Promise of a better future by Rahul Goma Phulore and Pooja Akshantal, Thought...Promise of a better future by Rahul Goma Phulore and Pooja Akshantal, Thought...
Promise of a better future by Rahul Goma Phulore and Pooja Akshantal, Thought...
 
Technology | Serverless
Technology | ServerlessTechnology | Serverless
Technology | Serverless
 
What we learned from the AWS Outage
What we learned from the AWS OutageWhat we learned from the AWS Outage
What we learned from the AWS Outage
 
AWS meetup: Containers@iZettle
AWS meetup: Containers@iZettleAWS meetup: Containers@iZettle
AWS meetup: Containers@iZettle
 
What's new in FME 2019: FME Desktop
What's new in FME 2019: FME DesktopWhat's new in FME 2019: FME Desktop
What's new in FME 2019: FME Desktop
 
Charles_Qian_Resume
Charles_Qian_ResumeCharles_Qian_Resume
Charles_Qian_Resume
 
Quarterly Technology Briefing, Manchester, UK September 2013
Quarterly Technology Briefing, Manchester, UK September 2013Quarterly Technology Briefing, Manchester, UK September 2013
Quarterly Technology Briefing, Manchester, UK September 2013
 
GreenButton-201502
GreenButton-201502GreenButton-201502
GreenButton-201502
 
3D Slideshow Transitions: Adding OpenGL-Accelerated Transitional Effects For ...
3D Slideshow Transitions: Adding OpenGL-Accelerated Transitional Effects For ...3D Slideshow Transitions: Adding OpenGL-Accelerated Transitional Effects For ...
3D Slideshow Transitions: Adding OpenGL-Accelerated Transitional Effects For ...
 

Similar to Electron performance and C++ in Mailspring

How to build a SaaS solution in 60 days
How to build a SaaS solution in 60 daysHow to build a SaaS solution in 60 days
How to build a SaaS solution in 60 days
Brett McLain
 
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Databricks
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Startupfest
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best Practices
Pavel Mička
 
IBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New TricksIBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New Tricks
Dejan Glozic
 
Coates bosc2010 clouds-fluff-and-no-substance
Coates bosc2010 clouds-fluff-and-no-substanceCoates bosc2010 clouds-fluff-and-no-substance
Coates bosc2010 clouds-fluff-and-no-substance
BOSC 2010
 
Building a system for machine and event-oriented data with Rocana
Building a system for machine and event-oriented data with RocanaBuilding a system for machine and event-oriented data with Rocana
Building a system for machine and event-oriented data with Rocana
Treasure Data, Inc.
 
Ajax Performance
Ajax PerformanceAjax Performance
Ajax Performance
kaven yan
 
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBusScaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Particular Software
 
Building a system for machine and event-oriented data - Data Day Seattle 2015
Building a system for machine and event-oriented data - Data Day Seattle 2015Building a system for machine and event-oriented data - Data Day Seattle 2015
Building a system for machine and event-oriented data - Data Day Seattle 2015
Eric Sammer
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive ui
Paul van Zyl
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
Amazon Web Services
 
How and why we evolved a legacy Java web application to Scala... and we are s...
How and why we evolved a legacy Java web application to Scala... and we are s...How and why we evolved a legacy Java web application to Scala... and we are s...
How and why we evolved a legacy Java web application to Scala... and we are s...
Katia Aresti
 
Building a system for machine and event-oriented data - Velocity, Santa Clara...
Building a system for machine and event-oriented data - Velocity, Santa Clara...Building a system for machine and event-oriented data - Velocity, Santa Clara...
Building a system for machine and event-oriented data - Velocity, Santa Clara...
Eric Sammer
 
Path to continuous delivery
Path to continuous deliveryPath to continuous delivery
Path to continuous delivery
Anirudh Bhatnagar
 
2017 Melbourne YOW! CTO Summit - Monolith to micro-services with CQRS & Event...
2017 Melbourne YOW! CTO Summit - Monolith to micro-services with CQRS & Event...2017 Melbourne YOW! CTO Summit - Monolith to micro-services with CQRS & Event...
2017 Melbourne YOW! CTO Summit - Monolith to micro-services with CQRS & Event...
Douglas English
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Panagiotis Kanavos
 
Fronteers 20131205 the realtime web
Fronteers 20131205   the realtime webFronteers 20131205   the realtime web
Fronteers 20131205 the realtime web
Bert Wijnants
 
Tech for the Non Technical - Anatomy of an Application Stack
Tech for the Non Technical - Anatomy of an Application StackTech for the Non Technical - Anatomy of an Application Stack
Tech for the Non Technical - Anatomy of an Application Stack
Intelligent_ly
 
Accelerating Analytics for the Future of Genomics
Accelerating Analytics for the Future of GenomicsAccelerating Analytics for the Future of Genomics
Accelerating Analytics for the Future of Genomics
Amazon Web Services
 

Similar to Electron performance and C++ in Mailspring (20)

How to build a SaaS solution in 60 days
How to build a SaaS solution in 60 daysHow to build a SaaS solution in 60 days
How to build a SaaS solution in 60 days
 
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best Practices
 
IBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New TricksIBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New Tricks
 
Coates bosc2010 clouds-fluff-and-no-substance
Coates bosc2010 clouds-fluff-and-no-substanceCoates bosc2010 clouds-fluff-and-no-substance
Coates bosc2010 clouds-fluff-and-no-substance
 
Building a system for machine and event-oriented data with Rocana
Building a system for machine and event-oriented data with RocanaBuilding a system for machine and event-oriented data with Rocana
Building a system for machine and event-oriented data with Rocana
 
Ajax Performance
Ajax PerformanceAjax Performance
Ajax Performance
 
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBusScaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
 
Building a system for machine and event-oriented data - Data Day Seattle 2015
Building a system for machine and event-oriented data - Data Day Seattle 2015Building a system for machine and event-oriented data - Data Day Seattle 2015
Building a system for machine and event-oriented data - Data Day Seattle 2015
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive ui
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
How and why we evolved a legacy Java web application to Scala... and we are s...
How and why we evolved a legacy Java web application to Scala... and we are s...How and why we evolved a legacy Java web application to Scala... and we are s...
How and why we evolved a legacy Java web application to Scala... and we are s...
 
Building a system for machine and event-oriented data - Velocity, Santa Clara...
Building a system for machine and event-oriented data - Velocity, Santa Clara...Building a system for machine and event-oriented data - Velocity, Santa Clara...
Building a system for machine and event-oriented data - Velocity, Santa Clara...
 
Path to continuous delivery
Path to continuous deliveryPath to continuous delivery
Path to continuous delivery
 
2017 Melbourne YOW! CTO Summit - Monolith to micro-services with CQRS & Event...
2017 Melbourne YOW! CTO Summit - Monolith to micro-services with CQRS & Event...2017 Melbourne YOW! CTO Summit - Monolith to micro-services with CQRS & Event...
2017 Melbourne YOW! CTO Summit - Monolith to micro-services with CQRS & Event...
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
 
Fronteers 20131205 the realtime web
Fronteers 20131205   the realtime webFronteers 20131205   the realtime web
Fronteers 20131205 the realtime web
 
Tech for the Non Technical - Anatomy of an Application Stack
Tech for the Non Technical - Anatomy of an Application StackTech for the Non Technical - Anatomy of an Application Stack
Tech for the Non Technical - Anatomy of an Application Stack
 
Accelerating Analytics for the Future of Genomics
Accelerating Analytics for the Future of GenomicsAccelerating Analytics for the Future of Genomics
Accelerating Analytics for the Future of Genomics
 

Recently uploaded

14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabhQuarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
aisafed42
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 

Recently uploaded (20)

14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabhQuarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 

Electron performance and C++ in Mailspring

  • 1. Electron Performance and C++ in Mailspring (or: what I’ve been up to for the last six months!)
  • 2. Me • Mac & iOS ➡ React & Electron • Run a small team doing React / mobile dev, now working on Mailspring. • Led the team building Nylas Mail from 2014–2016.
  • 3. Nylas Mail ➡ Mailspring • May 2017: Nylas API business booming—engineers pulled from Nylas Mail to fight growth fires! • Sept 2017: Nylas Mail officially sunset, re-licensed under MIT. 🎉 Mailspring: Fix longstanding issues, use Pro version revenue to run service and pay core contributors.
  • 4.
  • 5. ☄ Complaints about Nylas Mail • Long startup time • High battery impact • Uses too much RAM* Electron 😡 😤🚀🔥
  • 6. • Long startup time • High battery impact • Uses too much RAM* 👷( Complaints about Nylas Mail Electron
  • 7. Reducing startup time • Start loading a BrowserWindow as fast as possible • Watch out for sync I/O in main process • Use the ASAR format in production • Load less JavaScript (on launch)
  • 13. Heavy Node Modules 1.7MB of JSON 😱
  • 14. Devtron • Easy to find heavy dependencies and see total JS loaded. • `request` is 910k of JS. Can you use Fetch APIs?
 `bluebird` is 180k of JS. Can you use native Promise? Nylas Mail
  • 15. Devtron Mailspring • Easy to find heavy dependencies and see total JS loaded. • `request` is 910k of JS. Can you use Fetch APIs?
 `bluebird` is 180k of JS. Can you use native Promise?
  • 16. Devtron • Some things you can’t avoid… but you can load later. Who needs spellcheck in the first 500ms? More UI Plugins SpellcheckerCore Window Interactive in 1.0s
  • 17.
  • 18.
  • 19. Energy Impact Sync all mail, restart Mac, hide applications, wait 15 minutes
  • 20. Reducing Energy Impact • Check for animations / needless layout • Minimize use of setTimeout, setInterval. Don’t wake and perform work if you don’t need to. • Attach an event listener to `blur` that toggles a CSS class, use it to prevent animations.
  • 22. Checking for Animations Loading indicator with opacity: 0 animating forever!
  • 23. setTimeout / setInterval • Use smarter polling strategies: • Change polling rate based on Electron PowerMonitor state. • Poll when important events occur (window focus event) rather than all the time.
  • 24. But… what if it’s not enough? • Need to sync mail every few minutes, sometimes this requires polling. • Need to keep IDLE connections open to mail providers. • Need to keep streaming connection open to Mailspring server. 👷(😭 😢
  • 27. Enter C++ • Command line C++ processes replace the background “work” window. • Read actions on stdin, write JSON event stream to stdout. • Main window spawns these processes, binds to their stdio streams, and re-broadcasts events.
  • 28. C++ tradeoffs • In JavaScript, control flow is hard.
 (Promises, async/await, etc.) • In C++, control flow is easy but memory is hard. (Sync I/O on a few threads.) • The SQLite bindings for C are incredibly fast. • Shipping C++ cross-platform is hard.
  • 29. C++ is kind of… pretty? • The C++11 syntax is really elegant. • Modern features like condition_variable allow the sync engine to do almost no polling.
  • 32. Takeaways • Keep your dependencies light, use built-in APIs when possible. Check require tree with Devtron! • Use “Paint Flashing” to identify crippling CSS / layout issues. Minimize timer use if possible. • Combining Electron and C++ (or Haskell, or Go, etc.) isn’t that crazy.