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
290
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
230
gitc2016 react based architecture
yiminghe
1
190
antd at qcon2016
yiminghe
1
250
react-based architecture
yiminghe
2
190
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
340
react best practice
yiminghe
3
230
react at alipay
yiminghe
43
4.6k
form validation in react
yiminghe
4
580
Other Decks in Programming
See All in Programming
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.4k
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
1
260
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
170
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
560
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
2.7k
What's New in Android 2026
veronikapj
0
240
Embedded SREと共に達成した会員管理システムのAWS移行 - SRE NEXT 2026 ランチスポンサーセッション
niftycorp
PRO
1
3.2k
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
370
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
560
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
0
170
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
420
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
740
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
270
Thoughts on Productivity
jonyablonski
76
5.3k
Test your architecture with Archunit
thirion
1
2.3k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
300
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
640
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
The agentic SEO stack - context over prompts
schlessera
0
850
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
We Have a Design System, Now What?
morganepeng
55
8.2k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
470
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
A designer walks into a library…
pauljervisheath
211
24k
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