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
小程序终端技术架构
Search
yiminghe
March 30, 2019
Programming
310
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
小程序终端技术架构
yiminghe
March 30, 2019
More Decks by yiminghe
See All by yiminghe
支付宝小程序的开放架构
yiminghe
0
240
gitc2016 react based architecture
yiminghe
1
190
antd at qcon2016
yiminghe
1
260
react-based architecture
yiminghe
2
190
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
350
react best practice
yiminghe
3
240
react at alipay
yiminghe
43
4.6k
form validation in react
yiminghe
4
580
Other Decks in Programming
See All in Programming
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
0
1.3k
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
190
Intent as Code
shoppingjaws
6
1k
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
170
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
160
一参加者から『中の人』へ 〜全通PHPerがブースに立って学んだ、カンファレンスを100倍楽しむコツ〜
wp_daisuke
0
150
AHC070解法紹介
eijirou
0
120
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
310
What We Talk About When We Talk About XP
m_seki
2
620
Family mrubyの進捗
kishima
1
120
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
620
一人だけ、Kiroが静止する日
hideg
0
110
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
280
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
600
ラッコキーワード サービス紹介資料
rakko
1
4.9M
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
610
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
460
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
410
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
520
GraphQLとの向き合い方2022年版
quramy
50
15k
30 Presentation Tips
portentint
PRO
1
390
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Transcript
小程序终端技术架构 何一鸣/承玉
INTRODUCTION 2010 年加入阿里,先后负责 KISSY/ant-design/ant- design-mobile 等基础类库的架构和核心研发工作, 自 2016 起开始进行小程序相关工作,负责小程序前端
架构以及框架核心开发。 Github/Twitter/Gmail: yiminghe
&217(176 架构 性能优化 后续发展
JSCore 保活 机制 离线包 形式 精简 运行环境 扩展性
引入JSCore:小程序会创 建一个JSCore ,专门负 责逻辑处理,绑定所有页 面,页面只负责渲染,尽 可能提升每个页面的渲染 性能。 引入保活机制:当离开当 前小程序时,小程序会在 后台继续运行5分钟,再 次点击直接秒开。 小程序框架以离线包形式 在整个客户端层面统一管 理和更新,并且框架代码 会被UC内核统一缓存为 字节码,所有小程序业务 公用,减少业务包大小。 基础组件,统一api调用 方式,对于纯H5性能较 差的部分提供native实现 以提升性能(map、 input)。 npm第三方模块,自定义 组件,web-view。 3 5 体验差异小 4 5 6 7 小程序整体效果好,H5对开发者要求 高,产出结果体验差异较大 webview 渲染优化 同容器/内核结合优化框架渲染。 1 2
DSL (acss/axml/js) Mini-App bundle 编译构建 Mini-App container 离线包下载执行 framework
webview jscore video canvas …
Components Framework Native SDK React WEBVIEW IDE DSL(template/css/js) js
bundle build run
JS Template CSS App Page Component
App({ onLaunch() {}, onShow() {}, }) Page({ onLoad() {},
onUnload() {}, }) view {color: red} <view><C /></view> Component({ didMount() {}, didUnmount() {}, }) <view><C2 /></view> .c {color: green}
onInit deriveDataFromProps
JSCore Native App java/ios Page A webview Preloaded
webview JSON bridge JSON bridge framework worker.bundle framework render.bundle framework render.bundle
JSCore webview Page a js Page a css/template Page
b js webview Page b css/template native render data ui event render data ui event api system event
page data/component data 为 json 格式 Ø 不能有复杂对象,例如 new Date()
Ø 不能有循环引用,直接传输出错 Ø 不要直接修改 this.data, 使用 setData/$spliceData 异步渲染/事件 Ø setData:使用回调函数依赖渲染结果, setData(data, callback) Ø 只能静态阻止冒泡:catchTap
Native JSCore webview launch onLaunch page onLoad->onShow User Event
render onReady handler re-render send data navigateTo onHide onShow webview init data
&217(176 架构 性能优化 后续发展
0 50 100 150 200 250 300 350 50
90 130 170 210 250 290 330 370 410 小程序中渲染耗时随DOM节点数的变化曲线 小程序中渲染耗时随DOM节点数的变化曲线
0 50 100 150 200 250 300 1kB 2kB
25kB 50kB 75kB 150kB 300kB 500kB 1000kB 2000kB 数据传输耗时 (ms) 数据传输耗时 (ms)
$spliceData 指定路径修改数据 避免频繁调用 setData 控制 dataset 大小
避免过度调用同步 API AXML 中 for 指定 key
背景 包大小限制为 3M 不满足复杂应用。 包大小过大,网络不佳场景下,小程序首页启动慢。 完整包下载 主包下载 解压 校验
渲染 解压 校验 渲染 剩余包下载 解压 校验 首屏显示 现状: 4月:
背景 首屏 loading 时间长。 启发自 server-side render。 首次打开 执行
JS save html 再次打开
&217(176 架构 性能优化 后续发展
分包加载 snapshot 插件组件 component2 AI 云开放 API …
支付宝小程序 阿里小程序 AI
None