Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Mobile H5 性能优化
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
ningzbruc
July 09, 2013
Programming
1k
7
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Mobile H5 性能优化
Mobile Performance Optimization
ningzbruc
July 09, 2013
More Decks by ningzbruc
See All by ningzbruc
如何写出一个优秀的开源库
ningzbruc
0
68
去啊无线前端的一天
ningzbruc
1
200
React & Component
ningzbruc
0
54
阿里旅行去啊H5首页总结&Promise
ningzbruc
0
280
KISSY.Base - all about that Base
ningzbruc
0
140
Hammer.js
ningzbruc
1
350
淘宝旅行门票iPad版开发
ningzbruc
0
150
Travel on KISSY mini
ningzbruc
0
210
Events
ningzbruc
2
130
Other Decks in Programming
See All in Programming
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
450
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
7
1.9k
APNsからLive Activityを開始する話
yumnumm
0
150
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
150
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.4k
wkhtmltopdfの次どうするか問題2026
willnet
2
1.9k
JRuby: Past, Present, and Future
headius
0
220
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
150
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
110
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.5k
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
440
Featured
See All Featured
How to make the Groovebox
asonas
2
2.5k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
What's in a price? How to price your products and services
michaelherold
247
13k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
460
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
550
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
470
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
Automating Front-end Workflow
addyosmani
1369
210k
Docker and Python
trallard
47
4.2k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
300
GraphQLとの向き合い方2022年版
quramy
50
15k
Transcript
Mobile H5性能优化 淘宝航旅⽆无线前端⼩小组
Mobile H5性能优化 淘宝航旅⽆无线前端⼩小组
Why • 蜗⽜牛的⺴⽹网速 • 可怜的内存
⺴⽹网络分布
2012全国运营商3G⺴⽹网速对⽐比
https://speakerdeck.com/d2forum/ding-zhi-ban-she-ji-kai-fa-vsxiang-ying-shi-she-ji- kai-fa-zhi-xing-neng-ji-liu-liang
None
None
性能优化⺫⽬目标 更⼩小 + 更快
None
None
None
怎么做
Everything you’ve learned still applies 学到的知识不会过时 怎么做
⽂文件加载 • 减少请求(combo, css-sprites) • ⽆无阻塞加载(异步js,css加载) • ⽼老⽣生常谈...
http://mobitest.akamai.com/m/index.cgi
未优化前
combo+异步后
combo+异步后
combo+异步后 样式表阻⽌止脚本执⾏行!!!
样式表放在head最后⾯面
图⽚片优化
图⽚片优化 552.4K!!!
Data URI
Data URI
Data URI 1920.6K!!!
Data URI • 减少图像HTTP请求 • 体积增⼤大(约30%,gzip后约10%) • 不能被缓存
最佳实践 体积较⼩小并且重复率低的图⽚片使⽤用Data URI进⾏行 编码,⽐比如⼩小icon等
图⽚片压缩 http://tinypng.org/
图⽚片压缩
图⽚片压缩 210.9K!!!
压缩⼯工具 http://tinypng.org/ imageAlpha imageOptim JPEGmini
压缩⼯工具 http://tinypng.org/ imageAlpha imageOptim JPEGmini $ npm install -g imageoptim-cli
$ imageOptim -j -a -q -d path/to/images
代码瘦⾝身 http://a.tbcdn.cn/mw/base/styles/tms_h5.css
代码瘦⾝身 http://a.tbcdn.cn/mw/base/styles/tms_h5.css
None
None
我们需要优化代码
CSS优化 • 选择器优化 • 不要滥⽤用CSS3特性 • “position:fixed” • repaint &
reflow • ...
选择器优化 https://speakerdeck.com/jonrohan/githubs-css-performance https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Writing_efficient_CSS
不要滥⽤用特性 • box-shadow/text-shadow • transition/transform • background: gradient(...) • ...
滥⽤用CSS3特性会导致⻚页⾯面渲染变慢,滚动效果卡顿(⽐比如说...⼩小⽶米2)
不要滥⽤用特性 • box-shadow/text-shadow • transition/transform • background: gradient(...) • ...
滥⽤用CSS3特性会导致⻚页⾯面渲染变慢,滚动效果卡顿(⽐比如说...⼩小⽶米2)
不⽀支持position:fixed?
不⽀支持position:fixed?
position:fixed http://bradfrostweb.com/blog/post/mobile-web-problems/#fixed
慎⽤用position:fixed • 部分低版本系统不⽀支持 • 可视范围更⼩小 • html:100%+absolute+iscroll,代码量增加
js优化 • 尽量⽤用原⽣生代码 • DOM选择器性能优化 • DOM节点缓存 • 注意内存释放 •
...
尽量⽤用原⽣生代码 https://speakerdeck.com/yaypie/when-not-to-use-yui var myObj = {}; var myObj = Y.Base.create(...);
尽量⽤用原⽣生代码 https://speakerdeck.com/yaypie/when-not-to-use-yui var myObj = {}; var myObj = Y.Base.create(...);
https://speakerdeck.com/lijing00333/css-selector-performance
更多 • ⺴⽹网络监控 • 缓存 • 统计
⺴⽹网络监控 2G/3G/4G/Wifi?
缓存 • APP存在缓存问题 • APP退出之后清空缓存
统计 • 优化需要更多的数据统计⽀支持 • CNZZ,⾕谷歌分析,淘宝⽆无线指数
总结 如何做好⽆无线端的性能优化?
总结 • 不留余地 • 绞尽脑汁 • 鸡蛋挑⾻骨头 • 不择⼿手段 •
令⼈人发指 • 测试,测试,测试... • ...
to be continued.. 开发调试篇
The End.