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
320
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
250
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
360
react best practice
yiminghe
3
250
react at alipay
yiminghe
43
4.6k
form validation in react
yiminghe
4
580
Other Decks in Programming
See All in Programming
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
280
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
340
スマート反転とウェブアクセシビリティ
camiha
0
220
Verilogで学ぶCPU自作入門.pdf
uyuki234
8
3.8k
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
18
19k
Webの地図
yosuke_furukawa
PRO
6
4.9k
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
270
AHC070解法紹介
eijirou
0
140
アクセシビリティから考える情報設計
high_g_engineer
0
420
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
340
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.3k
Featured
See All Featured
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
560
Leo the Paperboy
mayatellez
10
2.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Producing Creativity
orderedlist
PRO
348
41k
Faster Mobile Websites
deanohume
310
32k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Skip the Path - Find Your Career Trail
mkilby
1
240
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.1k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Between Models and Reality
mayunak
4
470
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
890
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