Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Загрузка и Инициализация JavaScript
Search
Mikhail Davydov
October 11, 2012
Programming
0
240
Загрузка и Инициализация JavaScript
Video
https://www.youtube.com/watch?v=ra5J9R2WH5I
Mikhail Davydov
October 11, 2012
Tweet
Share
More Decks by Mikhail Davydov
See All by Mikhail Davydov
Back To Text UI
azproduction
3
280
Promise – это не больно
azproduction
0
190
Components Now!
azproduction
3
140
ШРИ - JavaScript Event Model
azproduction
0
190
ШРИ - Code Style
azproduction
0
110
HTML5 Camp - JavaScript на фронте и в тылу
azproduction
0
290
Code Fest - Работает? Стабильно? Эффективно?
azproduction
0
150
UWDC - Модули и сборка JavaScript
azproduction
0
200
Шаблонизация
azproduction
0
130
Other Decks in Programming
See All in Programming
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
200
階層構造を表現するデータ構造とリファクタリング 〜1年で10倍成長したプロダクトの変化と課題〜
yuhisatoxxx
3
950
2分台で1500examples完走!爆速CIを支える環境構築術 - Kaigi on Rails 2025
falcon8823
3
3.5k
詳しくない分野でのVibe Codingで困ったことと学び/vibe-coding-in-unfamiliar-area
shibayu36
3
4.7k
Pull-Requestの内容を1クリックで動作確認可能にするワークフロー
natmark
2
480
ネイティブ製ガントチャートUIを作って学ぶUICollectionViewLayoutの威力
jrsaruo
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
130
After go func(): Goroutines Through a Beginner’s Eye
97vaibhav
0
250
Catch Up: Go Style Guide Update
andpad
0
200
The Flutter Journey of Building a Live Streaming App — With a Side of Performance Tuning
u503
1
100
Your Perfect Project Setup for Angular @BASTA! 2025 in Mainz
manfredsteyer
PRO
0
150
CSC305 Lecture 05
javiergs
PRO
0
210
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
51k
We Have a Design System, Now What?
morganepeng
53
7.8k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Statistics for Hackers
jakevdp
799
220k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
Building Adaptive Systems
keathley
43
2.8k
Visualization
eitanlees
148
16k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
61k
Transcript
Загрузка и инициализация JavaScript приложения Михаил Давыдов @azproduction JavaScript и
Node.js разработчик Dump-IT, Екатеринбург, 25 мая 2012
2 Мобильный веб
3 Не весь код используется 40 %
4 Браузерный кэш
5 Тестовый прототип, 7 Кб/с http://tinyurl.com/loader-test
<script src="main.js"> </script> <script src="module.js"> </script> 6 Последовательная загрузка и
исполнение
7 9 Запросов 131.5 Кб 18 с DOM 17.5 c
<script src="main.js" async> </script> <script src="module.js" async> </script> 8 Параллельная
загрузка и исполнение
9 9 Запросов 131.5 Кб 18 с DOM 1.5 c
$LAB .script('main.js') .wait() .script('module.js'); 10 Параллельная загрузка, последовательный запуск http://labjs.com/
11 10 Запросов 136.9 Кб 18.2 с DOM 3.7 c
↑0.2 ↑5.4 ↑1
$ cat **/*.js > main.js $ java -jar yuicompressor.jar \
main.js -o main.min.js 12 Собираем и пакуем http://tinyurl.com/yui-compressor
13 6 Запросов 48 Кб 9.5 с DOM 9.1 c
↓8.5 ↓83.5 ↓3
14 AppCache — оффлайн хранилище
<html manifest="example.appcache"> </html> CACHE MANIFEST # v1 - 2011-08-13 http://example.com/index.html
http://example.com/main.js 15 AppCache Манифест
16 Преимущества AppCache 1. Надежное кэширование 2. Работа оффлайн 3.
Простое управление версиями 4. Своевременное обновление http://tinyurl.com/mdn-appcache
17 Кэш — 0 запросов, 0 Кб
AMD — Асинхронная декларация модулей 18 Выборочная загрузка http://requirejs.org/
19 Преимущества АMD 1. Грузим основные части 2. Остальное по
необходимости 3. Автодогрузка зависимостей 4. ... 5. PROFIT
20 8 Запросов 31.5 7.4 с DOM 5.1 c +2
+30 Кб +4 c ↓2.1 ↓16.5 ↑2
LMD — Ленивая декларация модулей 21 Ленивая загрузка и инициализация
https://github.com/azproduction/lmd
22 Преимущества LMD 1. Ленивая инициализация 2. Node.js-подобные модули 3.
Встроенный сборщик и упаковщик 4. Гибкий объем библиотеки 5. Горячая сборка проекта
23 6 Запросов 18 5.1 с DOM 5.1 c +2
+30 Кб +4 c ↓2.3 ↓13.5 ↓2
9 131.5 Кб 18 с 24 6 Запросов 18 5.1
с DOM 5.1 c ↓12.9 ↓113 ↓3
25 1. Используйте AppCache http://tinyurl.com/mdn-appcache http://tinyurl.com/confessjs 2. Соберите скрипты 3.
LMD или AMD +
26 + 1. Используйте AppCache 2. Соберите скрипты http://tinyurl.com/yui-compressor 3.
LMD или AMD
27 + 1. Используйте AppCache 2. Соберите скрипты 3. LMD
или AMD https://github.com/azproduction/lmd http://requirejs.org/
28 OVER 9000 Achievement unlocked! JS
29 Вопросы? LMD Confess Require YUIC CanIUse https://github.com/azproduction/lmd http://tinyurl.com/confessjs http://requirejs.org/
http://tinyurl.com/yui-compressor http://caniuse.com/ Тест http://tinyurl.com/loader-test
Михаил Давыдов JavaScript и Node.js разработчик
[email protected]
Twitter @azproduction Habr
http://azproduction.habrahabr.ru GitHub https://github.com/azproduction 30