SlideShare a Scribd company logo
Bundling: you are doing it wrong
Aleksey Shvayka @ Hell Yeah LLC
@shvaikalesh
Алексей Швайка "Bundling: you are doing it wrong"
Front End performance
Performance is a feature
Performance matters
We optimize wrong
Hacks
• Sprites
• Inlining
• Sharding
• Concatenation
• Cookieless domains
lodash vs native
Optimizing for V8
<button> is slow
The cost of transpiling in 2016
jQuery vs DOM4
Алексей Швайка "Bundling: you are doing it wrong"
Алексей Швайка "Bundling: you are doing it wrong"
AMP: good parts
• <script async>
• GPU animations
• Font optimization
• DOM read/write batching
• Microdata (JSON-LD)
Best practices
• <script async>
• GPU animations
• Font optimization
• DOM read/write batching
• Microdata (JSON-LD)
AMP: bad parts
• No <input>, <form>, <picture>
• Inlined CSS
• CSS micro-optimizations
• Invalid attributes
• <noscript>
Protocol is bottleneck
Brief history of HTTP
GET /http/0.9.html
<hypertext response>
GET /http/0.9.html
[connection closed]
HTTP/1.0
• Versioning, headers, methods
• Simple caching, basic auth
• Status codes
HTTP/1.1
• Advanced caching, Vary
• Range requests
• Compression, chunked
• Content negotiation
• OPTIONS method
HTTP/2
• Backwards compatible
• Great multiplexing
• Streams/frames
• Server push, PING, GOAWAY
spdy.createServer(tls, (req, res) => {
res.push('/main.js', (err, stream) => {
stream.end('console.log("hello, world!")')
})
res.end('<script src="/main.js"></script>')
}).listen(443)
Hacks HTTP/2
• Sprites Separate resources
• Inlining Server push
• Sharding Single host
• Concatenation Separate resources
• Cookieless domains Single host
HTTP/2 rollout
• Gradual
• Right away
• “Hack” per request
• When % of traffic will support it
SPDY
• IE 11
• Firefox
• Chrome
• Android 4
• Safari 8
HTTP/2
• IE 11
• Edge
• Firefox 41
• Chrome 36
• Safari 9
HTTP/2
• IE 11 (Windows 10)
• Edge (over TLS)
• Firefox 41 (over TLS)
• Chrome 36 (over TLS)
• Safari 9 (OS X El Capitan)
Why TLS is enforced?
Is not that slow?
CSS
Critical above-the-fold CSS
loadCSS.js
<body><link></body>
<link> unblocks content above
JavaScript
300 <script>s?
1. AMD
Алексей Швайка "Bundling: you are doing it wrong"
Алексей Швайка "Bundling: you are doing it wrong"
2. CommonJS
Preprocessing?
Bundling? AMD?
var modules = Object.create(null)
window.module = {
get exports() {
return modules[src()]
},
set exports(value) {
modules[src()] = value
}
}
var modules = Object.create(null)
window.module = {
get exports() {
return modules[src()]
},
set exports(value) {
modules[src()] = value
}
}
window.require = function(path) {
return modules[resolve(src(), path)]
}
var modules = Object.create(null)
window.module = {
get exports() {
return modules[src()]
},
set exports(value) {
modules[src()] = value
}
}
window.require = function(path) {
return modules[resolve(src(), path)]
}
function src() {
return document.currentScript.src
}
document.currentScript
var $scripts = document.getElementsByTagName("script")
var loaded = Object.create(null)
var $scripts = document.getElementsByTagName("script")
var loaded = Object.create(null)
document.addEventListener("load", function(event) {
var $target = event.target
if ($target.matches("script")) {
var source = $target.src
if (source) loaded[source] = null
}
}, true)
var $scripts = document.getElementsByTagName("script")
var loaded = Object.create(null)
document.addEventListener("load", function(event) {
var $target = event.target
if ($target.matches("script")) {
var source = $target.src
if (source) loaded[source] = null
}
}, true)
return searchStack(new Error().stack, function(source) {
if (source in loaded) return
return $scripts.find(function($script) {
return $script.src == source
})
})
3. ES6 Modules
When:
Spec for module loader?
whatwg/html/pull/443
<script type=module>
Алексей Швайка "Bundling: you are doing it wrong"
Features
• Only absolute or '/', './', '../'
• <script defer> semantics
• Module memorization
• CORS, UTF-8, enforced Content-Type
When:
first implementation?
bugs/webkit/id/148689
Using today?

More Related Content

PDF
Michael North "Ember.js 2 - Future-friendly ambitious apps, that scale!"
PPTX
Development of automated tests for ext js based web sites
PDF
BP101: A Modernized Workflow w/ Domino/XPages
PDF
Quick start with AngularJS
PDF
Write Once, Run Everywhere - Ember.js Munich
PDF
Conquering AngularJS Limitations
PPTX
[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS
PPTX
React basic by Yoav Amit, Wix
Michael North "Ember.js 2 - Future-friendly ambitious apps, that scale!"
Development of automated tests for ext js based web sites
BP101: A Modernized Workflow w/ Domino/XPages
Quick start with AngularJS
Write Once, Run Everywhere - Ember.js Munich
Conquering AngularJS Limitations
[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS
React basic by Yoav Amit, Wix

What's hot (20)

PDF
Integrating React.js Into a PHP Application
PPTX
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
PDF
React && React Native workshop
PDF
Frontend Application Architecture, Patterns, and Workflows
PPTX
React in Native Apps - Meetup React - 20150409
PDF
Learning React - I
PPTX
Silicon Valley JUG - How to generate customized java 8 code from your database
PPTX
Iconus 2016
PDF
Introduction to react
PDF
The Complementarity of React and Web Components
PDF
Client Vs. Server Rendering
PDF
CQ5 and Sling overview
PPTX
My first powershell script
PDF
AngularJS + React
KEY
Capybara-Webkit
PDF
React native: building native iOS apps with javascript
PDF
John Resig Beijing 2010 (English Version)
PDF
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
PPTX
Test driven development v1.0
PPTX
Combining Angular and React Together
Integrating React.js Into a PHP Application
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
React && React Native workshop
Frontend Application Architecture, Patterns, and Workflows
React in Native Apps - Meetup React - 20150409
Learning React - I
Silicon Valley JUG - How to generate customized java 8 code from your database
Iconus 2016
Introduction to react
The Complementarity of React and Web Components
Client Vs. Server Rendering
CQ5 and Sling overview
My first powershell script
AngularJS + React
Capybara-Webkit
React native: building native iOS apps with javascript
John Resig Beijing 2010 (English Version)
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
Test driven development v1.0
Combining Angular and React Together
Ad

Viewers also liked (20)

PDF
Paul Miller "Как подняться на open source"
PPTX
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
PPTX
Илья Климов "О драконах ни слова"
PDF
Григорий Шехет "Treasure hunt in the land of Reactive frameworks"
PDF
Алексей Рыбаков: "Wearable OS год спустя: Apple Watch 2.0, Android Wear 5.1.1...
PDF
"Frameworks in 2015" Андрей Листочкин
PDF
Евгений Жарков AngularJS: Good parts
PDF
Илья Прукко: "Как дизайнеру не становиться художником"
PDF
Анастасия Войтова: "Building profanity filters on mobile: clbuttic sh!t"
PDF
Fighting Fat Models (Богдан Гусев)
PPTX
Сергей Жук "Android Performance Tips & Tricks"
PDF
Скрам и Канбан: применимость самых распространенных методов организации умств...
PPT
"Spring Boot. Boot up your development" Сергей Моренец
PPTX
Трансформация команды: от инди разработки к играм с коммерческой успешностью
PDF
"После OOD: как моделировать предметную область в пост-объектном мире" Руслан...
PPTX
"Красная книга веб-разработчика" Виктор Полищук
PPTX
"Query Execution: Expectation - Reality (Level 300)" Денис Резник
PDF
Александр Махомет "Feature Flags. Уменьшаем риски при выпуске изменений"
PDF
Светлана Старикова "Building a self-managing team: why you should not have e...
PDF
Александр Воронов | Building CLI with Swift
Paul Miller "Как подняться на open source"
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
Илья Климов "О драконах ни слова"
Григорий Шехет "Treasure hunt in the land of Reactive frameworks"
Алексей Рыбаков: "Wearable OS год спустя: Apple Watch 2.0, Android Wear 5.1.1...
"Frameworks in 2015" Андрей Листочкин
Евгений Жарков AngularJS: Good parts
Илья Прукко: "Как дизайнеру не становиться художником"
Анастасия Войтова: "Building profanity filters on mobile: clbuttic sh!t"
Fighting Fat Models (Богдан Гусев)
Сергей Жук "Android Performance Tips & Tricks"
Скрам и Канбан: применимость самых распространенных методов организации умств...
"Spring Boot. Boot up your development" Сергей Моренец
Трансформация команды: от инди разработки к играм с коммерческой успешностью
"После OOD: как моделировать предметную область в пост-объектном мире" Руслан...
"Красная книга веб-разработчика" Виктор Полищук
"Query Execution: Expectation - Reality (Level 300)" Денис Резник
Александр Махомет "Feature Flags. Уменьшаем риски при выпуске изменений"
Светлана Старикова "Building a self-managing team: why you should not have e...
Александр Воронов | Building CLI with Swift
Ad

Similar to Алексей Швайка "Bundling: you are doing it wrong" (20)

PPTX
JavaScript Performance Patterns
PDF
Web Performance Part 4 "Client-side performance"
PPTX
JavaScript performance patterns
PPTX
JavaScript front end performance optimizations
PDF
Metarefresh
PPTX
My weekend startup: seocrawler.co
PPTX
DOTNET8.pptx
PPTX
How to generate customized java 8 code from your database
PDF
Everything is Awesome - Cutting the Corners off the Web
PDF
Developing High Performance Web Apps
PPTX
Edge of the Web
PDF
Progressive Downloads and Rendering
KEY
Developing High Performance Web Apps - CodeMash 2011
PDF
Cape Cod Web Technology Meetup - 2
ODP
Presentation of JSConf.eu
PPTX
Vlad zelinschi optimizing the critical rendering path
PPTX
ASP.NET: Present and future
PDF
Seven Versions of One Web Application
PPTX
Javascript for Wep Apps
PDF
LA Ember.js Meetup, Jan 2017
JavaScript Performance Patterns
Web Performance Part 4 "Client-side performance"
JavaScript performance patterns
JavaScript front end performance optimizations
Metarefresh
My weekend startup: seocrawler.co
DOTNET8.pptx
How to generate customized java 8 code from your database
Everything is Awesome - Cutting the Corners off the Web
Developing High Performance Web Apps
Edge of the Web
Progressive Downloads and Rendering
Developing High Performance Web Apps - CodeMash 2011
Cape Cod Web Technology Meetup - 2
Presentation of JSConf.eu
Vlad zelinschi optimizing the critical rendering path
ASP.NET: Present and future
Seven Versions of One Web Application
Javascript for Wep Apps
LA Ember.js Meetup, Jan 2017

More from Fwdays (20)

PDF
"Mastering UI Complexity: State Machines and Reactive Patterns at Grammarly",...
PDF
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
PPTX
"Computer Use Agents: From SFT to Classic RL", Maksym Shamrai
PPTX
"Як ми переписали Сільпо на Angular", Євген Русаков
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
PDF
"Validation and Observability of AI Agents", Oleksandr Denisyuk
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
PPTX
"Co-Authoring with a Machine: What I Learned from Writing a Book on Generativ...
PPTX
"Human-AI Collaboration Models for Better Decisions, Faster Workflows, and Cr...
PDF
"AI is already here. What will happen to your team (and your role) tomorrow?"...
PPTX
"Is it worth investing in AI in 2025?", Alexander Sharko
PDF
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
PDF
"Scaling in space and time with Temporal", Andriy Lupa.pdf
PDF
"Database isolation: how we deal with hundreds of direct connections to the d...
PDF
"Scaling in space and time with Temporal", Andriy Lupa .pdf
PPTX
"Provisioning via DOT-Chain: from catering to drone marketplaces", Volodymyr ...
PPTX
" Observability with Elasticsearch: Best Practices for High-Load Platform", A...
PPTX
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
PPTX
"Istio Ambient Mesh in production: our way from Sidecar to Sidecar-less",Hlib...
"Mastering UI Complexity: State Machines and Reactive Patterns at Grammarly",...
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
"Computer Use Agents: From SFT to Classic RL", Maksym Shamrai
"Як ми переписали Сільпо на Angular", Євген Русаков
"AI Transformation: Directions and Challenges", Pavlo Shaternik
"Validation and Observability of AI Agents", Oleksandr Denisyuk
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
"Co-Authoring with a Machine: What I Learned from Writing a Book on Generativ...
"Human-AI Collaboration Models for Better Decisions, Faster Workflows, and Cr...
"AI is already here. What will happen to your team (and your role) tomorrow?"...
"Is it worth investing in AI in 2025?", Alexander Sharko
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Database isolation: how we deal with hundreds of direct connections to the d...
"Scaling in space and time with Temporal", Andriy Lupa .pdf
"Provisioning via DOT-Chain: from catering to drone marketplaces", Volodymyr ...
" Observability with Elasticsearch: Best Practices for High-Load Platform", A...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"Istio Ambient Mesh in production: our way from Sidecar to Sidecar-less",Hlib...

Recently uploaded (20)

PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
Group 1 Presentation -Planning and Decision Making .pptx
A novel scalable deep ensemble learning framework for big data classification...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Hindi spoken digit analysis for native and non-native speakers
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Module 1.ppt Iot fundamentals and Architecture
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
observCloud-Native Containerability and monitoring.pptx
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Web App vs Mobile App What Should You Build First.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
1 - Historical Antecedents, Social Consideration.pdf
Programs and apps: productivity, graphics, security and other tools
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Getting started with AI Agents and Multi-Agent Systems
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Zenith AI: Advanced Artificial Intelligence

Алексей Швайка "Bundling: you are doing it wrong"