SlideShare a Scribd company logo
Bryan Phelps
ReactiveConf 2019
Re-architecting for performance
@bryphe
Overview
1) What is Onivim?
2) V1 Electron Architecture + Challenges
3) V2 Reason Architecture + Results
Fast, Beautiful Interface
…like Sublime Text
Top-Tier Language Support
…like VSCode
Modal Editing
…like Vim
…fastest way to go from thought to code
Onivim V1
V1 Architecture
RendererMain
Electron
Extension
Host
Neovim
V1 Architecture
Renderer
Redux React
TypeScript WebGL
Performance Challenge #1
Startup Time
Performance Challenge #2
Responsiveness
Renderer
Process
Neovim
Process
Key Press
Render
Msgpack
Input
Buffer Update
Screen Redraw
Window Metrics
Dimensions
Performance Challenge #2
Responsiveness
Event Loop
Event Loop
V1 Performance
Work
Startup Runtime
• Bundle Splitting
• Async Imports
• Minification
• Typing prediction
• Debounced rendering
• Split Redux stores
• Paint profiling
Always could do more…. but diminishing returns.
React
Application Code
Chromium
Node
Harfbuzz FreeType
Platform APIs
NPM Modules
Neovim
Typing Prediction
Bundle Splitting
Electron
V1 Architecture
React
Application Code
Chromium
Node
Harfbuzz FreeType
Platform APIs
NPM Modules
Neovim
Typing Prediction
Bundle Splitting
Electron
V1 Architecture
React
Application Code
Harfbuzz FreeType
Platform APIs
Neovim
Typing Prediction
Bundle Splitting
V1 Architecture
Native Dependencies
React
Application Code
Harfbuzz FreeType
Platform APIs
Synchronous Vim
Typing Prediction
Bundle Splitting
V1 Architecture
Native Dependencies
React
Application Code
Harfbuzz FreeType
Platform APIs
Native Dependencies
Synchronous Vim
Ideal Architecture
FUNctional UI
UI = ƒ(state)
...without all the extra layers!
How do we get
there?
• Built by the creator of
React
• Functional Language
• JavaScript-like Syntax
• <JSX />
• Compiles to native code
Reason
• Built by the creator of
React
• Functional Language
• JavaScript-like Syntax
• <JSX />
• Compiles to native code
ReasonML
• Built on OCaml
• UI + Application Framework
• React-like concepts
• Compiles to native code
• Desktop-only
Revery: Minimal App
Revery: Examples
V2 Architecture
Onivim 2
libvim
VSCode
Extension
Host
Native Reason
Revery
Node
Startup Time Memory Usage
Onivim v1
0.37.0
~5s ~250 MB
Onivim v2
master
~0.5s ~50 MB
Performance
Demo
Thank you!
@CrossR
@glennsl
@szbergeron
@KevinSjoberg
@jordwalke
@andreypopp
@ulrikstrid
@def
@bendersen
@kyldvs
@wokalski
@manuhornung
@prometheansacrifice
@jchavarri
@Et7f3
@lessp
…and all our backers and pre-orderers!
Thank you!
• Website: https://outrunlabs.com
• Pre-order: https://onivim.io
• Twitter: @bryphe / @oni_vim
@bryphe
ReactiveConf 2019
Re-architecting for performance

More Related Content

What's hot

TDD for APIs @ Europython 2015, Bilbao by Michael Kuehne
TDD for APIs @ Europython 2015, Bilbao by Michael KuehneTDD for APIs @ Europython 2015, Bilbao by Michael Kuehne
TDD for APIs @ Europython 2015, Bilbao by Michael Kuehne
Michael Kuehne-Schlinkert
 
Kubernetes Operators - the next frontier in application automation - Ádám Sándor
Kubernetes Operators - the next frontier in application automation - Ádám SándorKubernetes Operators - the next frontier in application automation - Ádám Sándor
Kubernetes Operators - the next frontier in application automation - Ádám Sándor
PROIDEA
 
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the footHow to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
Dennis Doomen
 
10/29 Austin Ansible MeetUp - AnsibleFest Talk & Extending Ansible
10/29 Austin Ansible MeetUp - AnsibleFest Talk & Extending Ansible10/29 Austin Ansible MeetUp - AnsibleFest Talk & Extending Ansible
10/29 Austin Ansible MeetUp - AnsibleFest Talk & Extending Ansible
tylerturk
 
[CLPE] Novidades do .net Framework 4.0
[CLPE] Novidades do .net Framework 4.0[CLPE] Novidades do .net Framework 4.0
[CLPE] Novidades do .net Framework 4.0
Felipe Pimentel
 
Using cyclomatic complexity to measure code complexity
Using cyclomatic complexity to measure code complexityUsing cyclomatic complexity to measure code complexity
Using cyclomatic complexity to measure code complexity
Jane Chung
 
After the Code
After the CodeAfter the Code
After the Code
Adam Whittingham
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Tim Burks
 
scriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibilityscriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibility
Filip W
 
GitLab Commit 2020: Ubiquitous quality through continuous testing pipelines
GitLab Commit 2020: Ubiquitous quality through continuous testing pipelinesGitLab Commit 2020: Ubiquitous quality through continuous testing pipelines
GitLab Commit 2020: Ubiquitous quality through continuous testing pipelines
Joseph Lust
 
Fast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCFast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPC
Tim Burks
 
Erich Gamma at SpringOne Platform 2017
Erich Gamma at SpringOne Platform 2017Erich Gamma at SpringOne Platform 2017
Erich Gamma at SpringOne Platform 2017
VMware Tanzu
 
Node & Express as Workflow Tools
Node & Express as Workflow ToolsNode & Express as Workflow Tools
Node & Express as Workflow Tools
FITC
 
Ddd melbourne 2011 C# async ctp
Ddd melbourne 2011  C# async ctpDdd melbourne 2011  C# async ctp
Ddd melbourne 2011 C# async ctp
Pratik Khasnabis
 
Brief introduction to Angular 2.0 & 4.0
Brief introduction to Angular 2.0 & 4.0Brief introduction to Angular 2.0 & 4.0
Brief introduction to Angular 2.0 & 4.0
Nisheed Jagadish
 
(R)evolutionize APM
(R)evolutionize APM(R)evolutionize APM
(R)evolutionize APM
Klaus Enzenhofer
 
Trunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsTrunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and Economics
Perforce
 
To Protect & To Serve
To Protect & To ServeTo Protect & To Serve
To Protect & To Serve
Jorge Ortiz
 
The new way to extend VSTS Build and Release
The new way to extend VSTS Build and ReleaseThe new way to extend VSTS Build and Release
The new way to extend VSTS Build and Release
Jesse Houwing
 
Incremental upgrade cookbook
Incremental upgrade cookbookIncremental upgrade cookbook
Incremental upgrade cookbook
Mark Juras
 

What's hot (20)

TDD for APIs @ Europython 2015, Bilbao by Michael Kuehne
TDD for APIs @ Europython 2015, Bilbao by Michael KuehneTDD for APIs @ Europython 2015, Bilbao by Michael Kuehne
TDD for APIs @ Europython 2015, Bilbao by Michael Kuehne
 
Kubernetes Operators - the next frontier in application automation - Ádám Sándor
Kubernetes Operators - the next frontier in application automation - Ádám SándorKubernetes Operators - the next frontier in application automation - Ádám Sándor
Kubernetes Operators - the next frontier in application automation - Ádám Sándor
 
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the footHow to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
 
10/29 Austin Ansible MeetUp - AnsibleFest Talk & Extending Ansible
10/29 Austin Ansible MeetUp - AnsibleFest Talk & Extending Ansible10/29 Austin Ansible MeetUp - AnsibleFest Talk & Extending Ansible
10/29 Austin Ansible MeetUp - AnsibleFest Talk & Extending Ansible
 
[CLPE] Novidades do .net Framework 4.0
[CLPE] Novidades do .net Framework 4.0[CLPE] Novidades do .net Framework 4.0
[CLPE] Novidades do .net Framework 4.0
 
Using cyclomatic complexity to measure code complexity
Using cyclomatic complexity to measure code complexityUsing cyclomatic complexity to measure code complexity
Using cyclomatic complexity to measure code complexity
 
After the Code
After the CodeAfter the Code
After the Code
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
 
scriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibilityscriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibility
 
GitLab Commit 2020: Ubiquitous quality through continuous testing pipelines
GitLab Commit 2020: Ubiquitous quality through continuous testing pipelinesGitLab Commit 2020: Ubiquitous quality through continuous testing pipelines
GitLab Commit 2020: Ubiquitous quality through continuous testing pipelines
 
Fast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCFast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPC
 
Erich Gamma at SpringOne Platform 2017
Erich Gamma at SpringOne Platform 2017Erich Gamma at SpringOne Platform 2017
Erich Gamma at SpringOne Platform 2017
 
Node & Express as Workflow Tools
Node & Express as Workflow ToolsNode & Express as Workflow Tools
Node & Express as Workflow Tools
 
Ddd melbourne 2011 C# async ctp
Ddd melbourne 2011  C# async ctpDdd melbourne 2011  C# async ctp
Ddd melbourne 2011 C# async ctp
 
Brief introduction to Angular 2.0 & 4.0
Brief introduction to Angular 2.0 & 4.0Brief introduction to Angular 2.0 & 4.0
Brief introduction to Angular 2.0 & 4.0
 
(R)evolutionize APM
(R)evolutionize APM(R)evolutionize APM
(R)evolutionize APM
 
Trunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsTrunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and Economics
 
To Protect & To Serve
To Protect & To ServeTo Protect & To Serve
To Protect & To Serve
 
The new way to extend VSTS Build and Release
The new way to extend VSTS Build and ReleaseThe new way to extend VSTS Build and Release
The new way to extend VSTS Build and Release
 
Incremental upgrade cookbook
Incremental upgrade cookbookIncremental upgrade cookbook
Incremental upgrade cookbook
 

Similar to Onivim 2: Re-architecting for Performance

Reactive Microservices with Quarkus
Reactive Microservices with QuarkusReactive Microservices with Quarkus
Reactive Microservices with Quarkus
Niklas Heidloff
 
Onivim: Modal Editing from the Future
Onivim: Modal Editing from the FutureOnivim: Modal Editing from the Future
Onivim: Modal Editing from the Future
Bryan Phelps
 
Nodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to heroNodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to hero
Nicola Del Gobbo
 
The Netflix API Platform for Server-Side Scripting
The Netflix API Platform for Server-Side ScriptingThe Netflix API Platform for Server-Side Scripting
The Netflix API Platform for Server-Side Scripting
Katharina Probst
 
How to double .net code value
How to double .net code valueHow to double .net code value
How to double .net code value
javOnet
 
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Codemotion
 
Xamarin como acelerador y solución de negocio
Xamarin como acelerador y solución de negocioXamarin como acelerador y solución de negocio
Xamarin como acelerador y solución de negocio
Florencia Nodar💻
 
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
Stuart Lodge
 
.NET Everywhere and for Everyone
.NET Everywhere and for Everyone.NET Everywhere and for Everyone
.NET Everywhere and for Everyone
James Montemagno
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with Nashorn
Maxime Najim
 
AlAzharTC | C# Course - Day 1
AlAzharTC | C# Course - Day 1AlAzharTC | C# Course - Day 1
AlAzharTC | C# Course - Day 1
Microsoft Tech Club - Al Azhar University
 
Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++
Ethan Ram
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
National Cheng Kung University
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
Maarten Balliauw
 
WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014
Minko3D
 
Nodejs overview
Nodejs overviewNodejs overview
Nodejs overview
Nicola Del Gobbo
 
The Job DSL Plugin: Introduction & What’s New
The Job DSL Plugin: Introduction & What’s NewThe Job DSL Plugin: Introduction & What’s New
The Job DSL Plugin: Introduction & What’s New
Daniel Spilker
 
C++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browserC++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browser
Andre Weissflog
 
All the reasons for choosing react js that you didn't know about - Avi Marcus...
All the reasons for choosing react js that you didn't know about - Avi Marcus...All the reasons for choosing react js that you didn't know about - Avi Marcus...
All the reasons for choosing react js that you didn't know about - Avi Marcus...
Codemotion Tel Aviv
 
.NET Innovations and Improvements
.NET Innovations and Improvements.NET Innovations and Improvements
.NET Innovations and Improvements
Jeff Chu
 

Similar to Onivim 2: Re-architecting for Performance (20)

Reactive Microservices with Quarkus
Reactive Microservices with QuarkusReactive Microservices with Quarkus
Reactive Microservices with Quarkus
 
Onivim: Modal Editing from the Future
Onivim: Modal Editing from the FutureOnivim: Modal Editing from the Future
Onivim: Modal Editing from the Future
 
Nodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to heroNodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to hero
 
The Netflix API Platform for Server-Side Scripting
The Netflix API Platform for Server-Side ScriptingThe Netflix API Platform for Server-Side Scripting
The Netflix API Platform for Server-Side Scripting
 
How to double .net code value
How to double .net code valueHow to double .net code value
How to double .net code value
 
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
 
Xamarin como acelerador y solución de negocio
Xamarin como acelerador y solución de negocioXamarin como acelerador y solución de negocio
Xamarin como acelerador y solución de negocio
 
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
C# - Azure, WP7, MonoTouch and Mono for Android (MonoDroid)
 
.NET Everywhere and for Everyone
.NET Everywhere and for Everyone.NET Everywhere and for Everyone
.NET Everywhere and for Everyone
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with Nashorn
 
AlAzharTC | C# Course - Day 1
AlAzharTC | C# Course - Day 1AlAzharTC | C# Course - Day 1
AlAzharTC | C# Course - Day 1
 
Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
 
WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014
 
Nodejs overview
Nodejs overviewNodejs overview
Nodejs overview
 
The Job DSL Plugin: Introduction & What’s New
The Job DSL Plugin: Introduction & What’s NewThe Job DSL Plugin: Introduction & What’s New
The Job DSL Plugin: Introduction & What’s New
 
C++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browserC++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browser
 
All the reasons for choosing react js that you didn't know about - Avi Marcus...
All the reasons for choosing react js that you didn't know about - Avi Marcus...All the reasons for choosing react js that you didn't know about - Avi Marcus...
All the reasons for choosing react js that you didn't know about - Avi Marcus...
 
.NET Innovations and Improvements
.NET Innovations and Improvements.NET Innovations and Improvements
.NET Innovations and Improvements
 

Recently uploaded

SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 
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
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
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
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 

Recently uploaded (20)

SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 
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
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
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
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 

Onivim 2: Re-architecting for Performance

Editor's Notes

  1. Hi ReactiveConf! My name is Bryan Phelps, and I’m really excited to be here today to talk to you about a code editor I’ve been working on called Onivim. I’m going to share with you today how we re-architected for performance, and not only is it faster, but we were able to get a cleaner application architecture out of it, too!
  2. I’m the founder of a company called outrun labs. Before that, I was working at Microsoft on a variety of cross-platform and web applications. You can find me on twitter / GitHub / discord as @bryphe.
  3. Here’s an overview of what I’ll be discussing - First, I’ll give you some quick background on Onivim - just enough so we can talk about the architecture. Second - I’ll describe our v1 architecture and the challenges we faced. Finally, I’ll talk about our v2 architecture
  4. So what is Onivim? It’s a code editor - but kind of a niche one. It aims to combine a few different worlds. Modal editing, like Vim. A modal editor is one that has different “modes” - insert mode is the one we’re used to in every editor from notepad, word, but modal editors have modes specifically for editing and navigating text with just the keyboard. A fast, beautiful interface - I think Sublime Text is the gold standard - it shows you can have a GUI that’s fast and performant. Top-tier language support, like VSCode The vision for Onivim is to take these ideas - bring them together - and ultimately, to be the fastest way to go from thought to codeAlthough there is still a lot of work left - I think our v2 is positioned architecturally to get us there.
  5. I want the fastest way to go from thought to code. A tool works for me, always keeps up, that never makes me wait or takes me out of the flow. It’s been a journey and we’re not there yet - but for this talk, I’d like to take you on that journey with me and share some my thoughts and learnings. Hopefully, even if you’re not interested in editors or Vim, the architecture pieces will still be interesting. So let’s rewind a bit and talk about the start of the project - our v1.
  6. This is a screenshot of our V1, and it’s really the same goal and vision… We shipped our v1 as a cross-platform Electron app that met some of these goals. Really the most important outcome for our v1 was I found there was a group of developers who were also interested in this hybrid. We also experimented with some fun ideas - like modal editing and Vim have a deserved reputation for being hard to learn - how can we make that easier? But it wasn’t perfect. In particular, we struggled with performance. It’s cool to hate on Electron on hacker news and stuff, but the reality is, there were issues that kept us from meeting that goal of being the fastest way to go from thought to code. The target audience - vim users - have a very high bar for performance. We sort of pursued more and more investments to get the performance that we wanted. We also had bugs around non-determinism with key presses - the worst kind of bugs you can have in an editor - and there was a lot of asynchronicity in our architecture that was complex to manage. It was really these combination of issues that led me to think about what an alternative architecture could look like. But let’s take a look under the hood at the tech stack of our v1
  7. Electron applications have a main process, which is like an orchestrator, and one or many renderer processes, which manage windows. We also had an extension host node process for running JS plugins, and we used an open-source project called Neovim to handle the Vim-layer modal editing for us. More information on Neovim: https://neovim.io
  8. Let’s zoom in our renderer process. Inside there, we used a Redux store, we used React for most of the UI, but for the editor surface we used WebGL. I really like this stack for web applications. Redux + React is kind of a gateway drug to functional programming. And for all the hate Electron gets, the reality is, it’s never been easier for a small team to ship a cross-platform application, and there’s a lot of value in that. I think the most powerful feature of Electron is not only that its cross-platform, but you can develop cross-platform with confidence - what I mean by that, is I can write my Electron app on one platform, and as long as I don’t use a narrow set of platform-specific APIs, I can be pretty sure it looks and feels the same everywhere and sort of an inherited benefit from the web platform.
  9. However, there were challenges, otherwise this talk wouldn’t be happening. As we built more and more, the application would get slower to start. And I realized - you don’t really appreciate all that the browser or a JS engine is doing for you - until you profile. So let’s check out the profile.
  10. So the timeline starts at 0.5 seconds - 500 milliseconds. And takes about 3 seconds total to start the application. For the first second, we’re not rendering anything - just an empty screen. From there, we finally see a titlebar at the 1 second mark. Then, we start see some UI, but it’s not quite done… we see a brief pop-in of a menu, and then finally our UI is ready. A second is literally billions of CPU cycles on the hardware I grabbed this profile - an intel i5 - so what is doing with all those cycles? Well, a lot of loading JavaScript! Our first couple scripts each take around ~300ms to parse and evaluate. The JS engine actually has to load, parse, and it might decide to leave as byte code or go even further to JIT at this time. It’s a lot of work, and it’s a testament to JS engines how quickly they manage to do this. But it is still an appreciable cost. And coming from languages that C or C++ that are compiled… it’s kind of crazy to me - I’m actually compiling the code with TypeScript, so why does it need to compile again when I run it? I look around at other applications for inspiration - Vim starts up instantly. Sublime text starts up instantly. Why can’t my app startup that quickly? To me and my users even 2 seconds is too long.
  11. Aside from startup performance, there were several other performance challenges. The main challenge on my mind was responsiveness. Responsiveness is the time from processing user input to showing the result on screen. Ideally, we should shoot for a maximum of 16ms - which is one frame at 60 frames per second. Games render at this rate, entire 3D scenes - why shouldn’t our editor be able to do that too?
  12. Onivim v1 used Neovim to basically do all the heavy lifting of text manipulation for us - we’d send it a key input, it would get put on an event loop, and we’d get responses back from Neovim - both a list of what changed in the buffer, and what to redraw on the screen. A specific challenge we had was overhead around asynchronicity. We’d have a key press come in, and then we’d send that to Neovim. Beyond that, we wanted to render additional things in our buffer - rich adorners, color widgets, minimap, tab indents, and to do that, we needed to know more about the window dimensions. This required at least one but usually more calls to help us map from a buffer position (line and column) to a pixel position on the screen. And we needed to do all these calls within a frame. Our measurements showed some jitter - usually they’d complete in 1ms, but sometimes more… and we’d run into situations where it’d be easy to miss a frame. Oh, and at the end of all that, we’d have to actually render, which isn’t trivial - and we can’t manage things like sync in the browser.
  13. We actually worked hard on performance. For startup, we did a lot of the recommended things: Bundle splitting - so that we don’t have to load all the javascript at once. We can defer some of it. Async imports - so we could parallelize the JS loading with other operations. Minification - helps to minimize the work the JS parser has to do - less characters == less work! For runtime performance, we did a lot too: -Keystrokes would be sent to a separate process - Neovim - to be handled and come back with an update for the screen. We implemented a ‘typing prediction’ to guess what the result of a keypress would be so we could render immediately. This added complexity though in cases where we guess ‘wrong’. — We debounced our Redux stores so that updates only came during animation frames. Before that, every state change would trigger a DOM change. We split up our Redux stores, to reduce the cost of processing updates. We had a big enough state and enough of actions that just the overhead of cloning the JS objects showed up on our profiler. And it’s true that we stopped short of a few potential optimizations - like pre-compiling byte code for startup. As a very small team, you reach the point of diminishing returns. And I could see additional incremental gains, but not the instant performance that myself and my users want. In the back of mind, I was thinking - why do we have even have to battle this? Why can’t our desktop app, our technology, be fast by default? Why is it that we have to work so hard to get startup performance to a couple seconds… when older apps like SublimeText or Notepad++ startup instantly?
  14. And if I look at our architecture from another perspective - the layers - this is what it looks like. At the bottom - the foundation - you have platform APIs. On top of that - if you’re using a tool like Electron - you’ve got Node, Chromium, Neovim. Tons and tons of npm modules - until you get up to React, Redux, and then finally, your application code. And on top of my application code - in red - is what I’d consider accidental complexity. Things that aren’t core to the application, but stuff we had to get acceptable performance.
  15. What could we do about it, though? Well for one… we’re using WebGL anyway, why not just cut out the middle-man and remove Electron? We could just use OpenGL directly, or a wrapper like Angle.
  16. If we get rid of Node and Chromium for our core editor, well, we have to figure out we’re going to do with React and NPM dependencies. Hopefully we could replace them with a streamlined set of native dependencies - but preserve the React paradigm.
  17. I also wanted to switch out our input handling to be synchronous, so that we can have better performance and avoid the challenges of synchronizing state across async boundaries. So I wanted to replace our current ‘neovim’ with some sort of Vim state machine that I could feed input and it would handle it synchronously. Finally… I wanted a tech stack that wouldn’t require me to add all this accidental complexity at the top of this stack to get the performance I wanted.
  18. So I kind of went Konde Marie on the stack, streamlined it, and end up with what would be my ideal architecture, for our desktop app. What I want is a way to have the React paradigm…. But without any JavaScript. This could help our startup time tremendously if we could somehow didn’t need to do that parsing. Finally, if we had a synchronous model for handling input where we process the input and render immediately without asychronicity - we can meet our responsiveness goals and simplify our state management.
  19. I wanted to keep this React paradigm of your UI as a pure function of your state, just with a more streamlined stack - because I think its great to work with (and… your state as a pure function of your previous state and action).
  20. How do we get there? That was really on my mind. And I didn’t have the answer, in fact, I considered just putting the project on hold, because I didn’t think we could meet our goals with the current tech stack… I thought about switching to C++ or Rust and using a UI framework there - it is a desktop app - maybe Qt— but I’m stubborn, and I’d miss that React-style UI development.
  21. It just so happened, around this time, I learned about an exciting project called Reason.
  22. It’s built by the creator of React - Jordan Walke - imagine if you had a language built for React. It’s a functional language, but it’s pragmatic - you can do imperative, even OO, have mutable objects, although its geared and optimized for a functional approach - but it means you can be productive quickly without needing to climb an ivory tower of monads and category theory. It looks like JS, has JSX, and importantly for me… compiles to native code.
  23. (bullet points) It’s actually not a new language… it’s essentially a wrapper around a language called OCaml, which has been around for a while and has investment from companies like JaneStreet. This ‘compiles to native code’ aspect is really what can save us on startup performance. Recall from my performance profile - so much time was spent evaluating JavaScript. Well with native code - there’s no evaluation step - you compile directly to machine code!
  24. Around December last year, we started prototyping - what could this editor look like built on Reason? And this was the very first screenshot we had of the prototyping of our V2. It’s so ugly, the text rendering is horrible, no gamma correction… but we had all the pieces we needed. It makes you appreciate what Electron does - a mature framework on a mature platform, the browser . We could render text, we could render rectangles, and even icons. All the ingredients for a code editor, the rest is just details.
  25. Revery is a UI and application framework, built on Reason, with React-like concepts, that compiles to native code. It’s desktop only for now, the main use case is for Onivim 2, but we’d like branch out to mobile. Let’s take a look at some more code.
  26. This is the simplest, smallest Revery app - simply opens a Window, and renders an empty view. If you squint, it almost looks like JavaScript - but this compiles to native code. The `App.start` is the entry point, and takes a function that gets passed an app instance. You can think of that like ReactDOM.render, just for a native application. And with that app instance - you can create a window, and with that window, you can create a UI. `UI.start` is a lot like `ReactDOM.render` just a native rendition
  27. This is a snippet of source code from our prototype - and this is the top level UI component. It looks a bit like React - you have compassable components. We realized some of this stuff could be more general, so we factored it out to a UI framework called Revery.
  28. These are a few other apps built with Revery: Revery examples: https://github.com/revery-ui/revery Chesster by @kyldvs: https://github.com/kyldvs/chesster Camlsynth by @kenwheeler: https://github.com/kenwheeler/camlsynth
  29. So we took Revery, doubled down on our functional approach, and continued building, and we’ve been making steady progress building an app on this stack. It’s still ‘pre-alpha’ but we’re moving forward.
  30. The architecture we landed on was a fast, native code front-end built with Reason. This uses Revery for the UI and application life cycle. We also created a library for Vim, called libvim, which is agnostic of the terminal, and has a synchronous API. Vim itself has a blocking API for input, so we sort of had to invert the input model. Because the front-end is native code, it really solves our startup issue - we don’t need to load and evaluate JavaScript anymore. This is the goal of our next milestone - to wire this up. We didn’t get out of the JS game entirely, because we want to leverage VSCode extensions - so we still have a node process, but in the backend, entirely async. And the protocol is designed to be async so it doesn’t impact our front-ends performance. This is our next big goal, to graduate from ‘pre-alpha’ to ‘alpha’ - isto wire this piece up. But it’s a cool architecture, because we get the benefit of a fast, native front-end while being able to leverage the breadth and power VSCode extensions.
  31. These are point-in-time, ballpark perf numbers for startup - with a small JSON file. If you didn’t ’t fall asleep yet, you might notice this 5s number is greater than 3.5 s I showed - that’s because it includes other aspects - when you start an electron app, the main process starts first and then kicks off the renderer process - there’s more that happens in the end-to-end flow. The crazy thing though, is there’s lots of low hanging fruit left for us in the native code world - our drawing layer is wildly inefficient, we’re not even using the ocaml optimizing compiler, there’s blocking I/O on our start path… but it’s still faster.
  32. So I’ll show a quick demo - it’s off master, still very much alpha on this new tech stack- but I’m going to open up oni2’s package.json file and make some changes. Want to try it yourself? Instructions here to build from source: https://onivim.github.io/docs/for-developers/building I’m using my favorite VSCode theme, a theme called LaserWave. Let’s open the key displayer so you can see what I’m doing I’m going to fix this .ccc extension - I can jump down and use the change in quote command to do quick replacement. Now I’m eyeing this ‘esy’ block above… I want to move it. I think this combination of modal editing, first-class language support, and responsiveness is tremendously productive, although modal editing does have a learning curve - and we’re thinking about ways we can lower that.
  33. Everything I’ve been building is standing on the shoulders of others - there is so much great work happening in the OCaml ecosystem, the Reason ecosystem, and I’ve been tremendously appreciative of all the building blocks and investments others have made. Big thanks to everyone who’s help backed and pre-order the project too and let us dive this deep!
  34. You can support the project by pre-ordering at https://v2.onivim.io
  35. And thanks again everyone for being here and coming to my talk!
  36. Hi ReactiveConf! My name is Bryan Phelps, and I’m really excited to be here today to talk to you about a code editor I’ve been working on called Onivim. I’m going to share with you today how we re-architected for performance, and not only is it faster, but we were able to get a cleaner application architecture out of it, too! ∫∫