SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Building high
performance web
applications with Preact
Maurice de Beijer
@mauricedb
Topics
 Why performance?
 Why Preact?
 ProgressiveWeb Apps
 The PRPL pattern
© ABL - The Problem Solver 2
 Maurice de Beijer
 The Problem Solver
 MicrosoftAzure MVP
 Freelance developer/instructor
 Twitter: @mauricedb, @NG_Tutorial and @React_Tutorial
 Web: http://www.TheProblemSolver.nl
 E-mail: maurice.de.beijer@gmail.com
3
Try it  https://bit.ly/dnz-preact
© ABL - The Problem Solver 4
Why performance?
© ABL - The Problem Solver 5
Why
performance?
 40% of the website traffic is from mobile devices.
 Bol.com in July 2016
 Adding 100 ms of latency costs 1% of sales.
 Amazon.com
© ABL - The Problem Solver 6
What is fast?
© ABL - The Problem Solver 7
It depends 
© ABL - The Problem Solver 8
“Performance is the art of
avoiding work, and
making any work you do
as efficient as possible”
-- Paul Lewis --
© ABL - The Problem Solver 9
DOMContent
Loaded
© ABL - The Problem Solver 10
First
meaningful
paint
© ABL - The Problem Solver 11
Time to
interactive
© ABL - The Problem Solver 12
Right size
framework
© ABL - The Problem Solver 13
Why Preact?
© ABL - The Problem Solver 14
Jason Miller
@_developit
© ABL - The Problem Solver 15
Preact
=
React +
exercise
© ABL - The Problem Solver 16
A Preact
component
import { h, render, Component } from 'preact’; // <= h() replaces React.createElement()
class Clock extends Component { // <= Always ES2015 classes
constructor() {
super();
this.state.now = new Date();
}
componentDidMount() {
this.timer = setInterval(() => this.setState({ now: new Date() }), 1000);
}
componentWillUnmount() {
clearInterval(this.timer);
}
render({}, {now}) { // <= props and state passed
return <span>{ now.toLocaleTimeString() }</span>;
}
}
render(<Clock />, document.body); // <= render() instead of ReactDOM.render()
© ABL - The Problem Solver 17
Babel
{
"plugins": [
["transform-react-jsx", { "pragma":"h" }]
]
}
© ABL - The Problem Solver 18
What is
missing?
 PropType validation.
 Part of preact-compat
 React.Children.
 Part of preact-compat
 Synthetic Events.
 Preact only targets the Browser
 Context is simplified.
© ABL - The Problem Solver 19
“It's easier to make a
fast app than to speed
up a slow app”
-- Me --
© ABL - The Problem Solver 20
ECMAScript
imports
import _ from 'lodash';
_.forEach(data, e => console.log(e));
© ABL - The Problem Solver 21
import { forEach } from 'lodash/forEach';
forEach(data, e => console.log(e));
Use source-
map-explorer
© ABL - The Problem Solver 22
ProgressiveWebApps
& the PRPL Pattern
© ABL - The Problem Solver 23
PRPL
 Push critical resources for the initial URL route.
 Render initial route.
 Pre-cache remaining routes.
 Lazy-load and create remaining routes on demand.
© ABL - The Problem Solver 24
Push
© ABL - The Problem Solver 25
HTTP/2
© ABL - The Problem Solver 26
Latency
© ABL - The Problem Solver 27
Render initial route
© ABL - The Problem Solver 28
Server side
rendering
© ABL - The Problem Solver 29
Prerendering
© ABL - The Problem Solver 30
Inline
critical
CSS
© ABL - The Problem Solver 31
Pre-cache
remaining routes
© ABL - The Problem Solver 32
Cache using
ServiceWorker
© ABL - The Problem Solver 33
Lazy-Loading
© ABL - The Problem Solver 34
Code splitting
© ABL - The Problem Solver 35
Only render
above the fold
© ABL - The Problem Solver 36
Conclusion
 Everyone loves faster web apps.
 And they are good for business
 Do as few request as possible to display the first page.
 The fastest HTTP request is one not made
 Use the PRPL pattern
 Preact is small and fast.
 The CLI gives you most of the PRPL pattern out of the box
© ABL - The Problem Solver 37
Maurice de Beijer
@mauricedb
maurice.de.beijer
@gmail.com
© ABL - The Problem Solver 38

Weitere ähnliche Inhalte

Was ist angesagt?

Simple todo app with meteor
Simple todo app with meteorSimple todo app with meteor
Simple todo app with meteor
Alex Long
 
Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012
slandelle
 

Was ist angesagt? (20)

Reactjs workshop
Reactjs workshop Reactjs workshop
Reactjs workshop
 
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréTestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
 
learning react
learning reactlearning react
learning react
 
Simple todo app with meteor
Simple todo app with meteorSimple todo app with meteor
Simple todo app with meteor
 
React and Flux life cycle with JSX, React Router and Jest Unit Testing
React and  Flux life cycle with JSX, React Router and Jest Unit TestingReact and  Flux life cycle with JSX, React Router and Jest Unit Testing
React and Flux life cycle with JSX, React Router and Jest Unit Testing
 
React in production
React in productionReact in production
React in production
 
Getting Started with React-Nathan Smith
Getting Started with React-Nathan SmithGetting Started with React-Nathan Smith
Getting Started with React-Nathan Smith
 
React on es6+
React on es6+React on es6+
React on es6+
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Introduce Flux & react in practices (KKBOX)
Introduce Flux & react in practices (KKBOX)Introduce Flux & react in practices (KKBOX)
Introduce Flux & react in practices (KKBOX)
 
Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012
 
React Fundamentals - Jakarta JS, Apr 2016
React Fundamentals - Jakarta JS, Apr 2016React Fundamentals - Jakarta JS, Apr 2016
React Fundamentals - Jakarta JS, Apr 2016
 
ReactJS.NET - Fast and Scalable Single Page Applications
ReactJS.NET - Fast and Scalable Single Page ApplicationsReactJS.NET - Fast and Scalable Single Page Applications
ReactJS.NET - Fast and Scalable Single Page Applications
 
Debugging with VS2019
Debugging with VS2019Debugging with VS2019
Debugging with VS2019
 
Futureproof angular 1.x applications - yannick houbrix
Futureproof angular 1.x  applications - yannick houbrixFutureproof angular 1.x  applications - yannick houbrix
Futureproof angular 1.x applications - yannick houbrix
 
Gatling
GatlingGatling
Gatling
 
Pitfalls in Performance Testing AxxesCC 06/2015
Pitfalls in Performance Testing AxxesCC 06/2015Pitfalls in Performance Testing AxxesCC 06/2015
Pitfalls in Performance Testing AxxesCC 06/2015
 
Gatling Performance Workshop
Gatling Performance WorkshopGatling Performance Workshop
Gatling Performance Workshop
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 

Ähnlich wie Building high-performance web applications with Preact

Introduction to MVC in Flex and HydraMVC
Introduction to MVC in Flex and HydraMVCIntroduction to MVC in Flex and HydraMVC
Introduction to MVC in Flex and HydraMVC
cltru
 

Ähnlich wie Building high-performance web applications with Preact (20)

Building high performance web applications
Building high performance web applicationsBuilding high performance web applications
Building high performance web applications
 
Building high performance web applications
Building high performance web applicationsBuilding high performance web applications
Building high performance web applications
 
Building high performance web applications
Building high performance web applicationsBuilding high performance web applications
Building high performance web applications
 
Building reliable applications with React, C#, and Azure
Building reliable applications with React, C#, and AzureBuilding reliable applications with React, C#, and Azure
Building reliable applications with React, C#, and Azure
 
Building large and scalable mission critical applications with React
Building large and scalable mission critical applications with ReactBuilding large and scalable mission critical applications with React
Building large and scalable mission critical applications with React
 
Better React state management with Redux
Better React state management with ReduxBetter React state management with Redux
Better React state management with Redux
 
Building Reliable Applications Using React, .NET & Azure
Building Reliable Applications Using React, .NET & AzureBuilding Reliable Applications Using React, .NET & Azure
Building Reliable Applications Using React, .NET & Azure
 
Design Based Dev
Design Based DevDesign Based Dev
Design Based Dev
 
Impact2014: Practical Performance Troubleshooting
Impact2014: Practical Performance TroubleshootingImpact2014: Practical Performance Troubleshooting
Impact2014: Practical Performance Troubleshooting
 
Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)
 
The new React
The new React The new React
The new React
 
The productive developer guide to React
The productive developer guide to ReactThe productive developer guide to React
The productive developer guide to React
 
Isomorphic React Applications: Performance And Scalability
Isomorphic React Applications: Performance And ScalabilityIsomorphic React Applications: Performance And Scalability
Isomorphic React Applications: Performance And Scalability
 
Real World Problem Solving Using Application Performance Management 10
Real World Problem Solving Using Application Performance Management 10Real World Problem Solving Using Application Performance Management 10
Real World Problem Solving Using Application Performance Management 10
 
ASP Net
ASP NetASP Net
ASP Net
 
Institute Management System-Synopsis.pdf
Institute Management System-Synopsis.pdfInstitute Management System-Synopsis.pdf
Institute Management System-Synopsis.pdf
 
Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0
Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0
Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0
 
Introduction to MVC in Flex and HydraMVC
Introduction to MVC in Flex and HydraMVCIntroduction to MVC in Flex and HydraMVC
Introduction to MVC in Flex and HydraMVC
 
React and Web Performance
React and Web Performance React and Web Performance
React and Web Performance
 
Advanced Modeling & Simulation Techniques for Multibody Robotic Systems
Advanced Modeling & Simulation Techniques for Multibody Robotic SystemsAdvanced Modeling & Simulation Techniques for Multibody Robotic Systems
Advanced Modeling & Simulation Techniques for Multibody Robotic Systems
 

Mehr von Maurice De Beijer [MVP]

Mehr von Maurice De Beijer [MVP] (20)

Practice TypeScript Techniques Building React Server Components App
Practice TypeScript Techniques Building React Server Components AppPractice TypeScript Techniques Building React Server Components App
Practice TypeScript Techniques Building React Server Components App
 
A foolproof Way to Estimate a Software Project
A foolproof Way to Estimate a Software ProjectA foolproof Way to Estimate a Software Project
A foolproof Way to Estimate a Software Project
 
Surati Tech Talks 2022 / Build reliable Svelte applications using Cypress
Surati Tech Talks 2022 / Build reliable Svelte applications using CypressSurati Tech Talks 2022 / Build reliable Svelte applications using Cypress
Surati Tech Talks 2022 / Build reliable Svelte applications using Cypress
 
Build reliable Svelte applications using Cypress
Build reliable Svelte applications using CypressBuild reliable Svelte applications using Cypress
Build reliable Svelte applications using Cypress
 
Building Reliable Applications Using React, .NET & Azure
Building Reliable Applications Using React, .NET & AzureBuilding Reliable Applications Using React, .NET & Azure
Building Reliable Applications Using React, .NET & Azure
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
Building reliable web applications using Cypress
Building reliable web applications using CypressBuilding reliable web applications using Cypress
Building reliable web applications using Cypress
 
Getting started with React Suspense and concurrent rendering
Getting started with React Suspense and concurrent renderingGetting started with React Suspense and concurrent rendering
Getting started with React Suspense and concurrent rendering
 
React suspense, not just for Alfred Hitchcock
React suspense, not just for Alfred HitchcockReact suspense, not just for Alfred Hitchcock
React suspense, not just for Alfred Hitchcock
 
From zero to hero with the Reactive extensions for JavaScript
From zero to hero with the Reactive extensions for JavaScriptFrom zero to hero with the Reactive extensions for JavaScript
From zero to hero with the Reactive extensions for JavaScript
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
From zero to hero with the reactive extensions for JavaScript
From zero to hero with the reactive extensions for JavaScriptFrom zero to hero with the reactive extensions for JavaScript
From zero to hero with the reactive extensions for JavaScript
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
I am hooked on React
I am hooked on ReactI am hooked on React
I am hooked on React
 
Create flexible React applications using GraphQL apis
Create flexible React applications using GraphQL apisCreate flexible React applications using GraphQL apis
Create flexible React applications using GraphQL apis
 
Create flexible react applications using GraphQL API's
Create flexible react applications using GraphQL API'sCreate flexible react applications using GraphQL API's
Create flexible react applications using GraphQL API's
 
Docker for a .NET web developer
Docker for a .NET web developerDocker for a .NET web developer
Docker for a .NET web developer
 
From zero to hero with the reactive extensions for JavaScript
From zero to hero with the reactive extensions for JavaScriptFrom zero to hero with the reactive extensions for JavaScript
From zero to hero with the reactive extensions for JavaScript
 
Docker containers on Windows
Docker containers on WindowsDocker containers on Windows
Docker containers on Windows
 
From zero to hero with the reactive extensions for java script
From zero to hero with the reactive extensions for java scriptFrom zero to hero with the reactive extensions for java script
From zero to hero with the reactive extensions for java script
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Building high-performance web applications with Preact

Hinweis der Redaktion

  1. https://pixabay.com/nl/supersonische-vechter-vliegtuigen-63211/
  2. https://pixabay.com/nl/boord-blackboard-lettertype-1805318/
  3. https://www.pexels.com/photo/train-on-railroad-tracks-against-sky-258367/
  4. https://unsplash.com/photos/EXcDH29WLbg
  5. https://pixabay.com/nl/dolfijn-kind-kinderen-spelen-1548448/
  6. https://pixabay.com/nl/marokko-truck-vrachtwagen-hooi-842660/
  7. https://pixabay.com/nl/draaien-loper-lange-afstand-fitness-573762/
  8. https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
  9. https://pixabay.com/en/technology-servers-server-1587673/
  10. https://pixabay.com/nl/tools-hamer-nagel-nagels-boor-15539/
  11. https://jonassebastianohlsson.com/criticalpathcssgenerator/
  12. https://pixabay.com/nl/systeem-netwerk-nieuws-persoonlijke-2546093/
  13. https://unsplash.com/search/splitting?photo=Xxd33FUBQeA
  14. https://pixabay.com/nl/sprinkhaan-viridissima-groene-193721