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
小程序终端技术架构
Search
yiminghe
March 30, 2019
Programming
280
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
210
gitc2016 react based architecture
yiminghe
1
190
antd at qcon2016
yiminghe
1
240
react-based architecture
yiminghe
2
180
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
330
react best practice
yiminghe
3
230
react at alipay
yiminghe
43
4.5k
form validation in react
yiminghe
4
580
Other Decks in Programming
See All in Programming
AIとRubyの静的型付け
ukin0k0
0
560
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
330
Lessons from Spec-Driven Development
simas
PRO
0
150
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
510
Signal Forms: Beyond the Basics @ngBaguette 2026 in Paris
manfredsteyer
PRO
0
230
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
530
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
210
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
320
Oxcを導入して開発体験が向上した話
yug1224
4
300
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
210
RTSPクライアントを自作してみた話
simotin13
0
520
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
480
Featured
See All Featured
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
210
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
200
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Six Lessons from altMBA
skipperchong
29
4.3k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
140
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
140
エンジニアに許された特別な時間の終わり
watany
107
250k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
240
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
The untapped power of vector embeddings
frankvandijk
2
1.7k
Automating Front-end Workflow
addyosmani
1370
210k
First, design no harm
axbom
PRO
2
1.2k
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