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
asm.js 減量やってみた
Search
ueshita
February 22, 2017
Programming
1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
asm.js 減量やってみた
Emscriptenでビルドされたjsファイルのサイズは巨大です。
サイズを小さくする手法をいろいろ紹介します。
ueshita
February 22, 2017
More Decks by ueshita
See All by ueshita
こわくない!! たのしい!! GDExtension
ueshita
0
2.3k
Godot Engine完全に理解したかった
ueshita
1
680
UnmanagedThreadノススメ
ueshita
2
8.4k
Unityで3Dツールを作って開発を加速する
ueshita
3
3.7k
EmscriptenのOpenGLと純粋なWebGLと共存させる黒魔術
ueshita
1
5.1k
Other Decks in Programming
See All in Programming
Agents on Rails - Rails at Scale 2026
irinanazarova
0
570
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.5k
Next.js: The final boss of Web Performance
guaca
0
280
Performance Optimization With LLMs
xleitix
0
130
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
ActionController meets Protocol Buffers
sorah
0
550
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
320
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
280
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
180
Featured
See All Featured
Building the Perfect Custom Keyboard
takai
2
910
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Deep Space Network (abreviated)
tonyrice
0
370
We Are The Robots
honzajavorek
0
400
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
From π to Pie charts
rasagy
1
400
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
What's in a price? How to price your products and services
michaelherold
247
13k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Un-Boring Meetings
codingconduct
0
460
Color Theory Basics | Prateek | Gurzu
gurzu
1
490
Transcript
asm.js 減量やってみた うえした (@ueshita)
EmscriptenでCライブラリを移植してみた うごいた。 わーい!すごーい!たーのしー!
Webエンジニアに見せてみた Web「ええやん。便利やん!」 Web「そんで、(JSのサイズは)なんぼなん?」 ぼく「1.2MBです・・・(震え声)」 Web「・・・」
Webの世界でMBはデカすぎる jQuery : 100KB three.js: 500KB my-library.js : 1.2MB 圧縮しても
400KB!
結果にコミットしたい JSファイルサイズを減量しないと(使命感)
最適化オプションに -Oz を指定 -O2 → -Oz 50KB 減った!
--llvm-lto 1 を付ける 関数呼び出しがいい感じにインライン化される 40KB 減った! --llvm-lto 2 or 3
等もあるが結果は変わらなかった。
-s NO_FILESYSTEM=1 を付ける 使用していないEmscriptenファイルシステムをカット (fopenとかfstreamが使えなくなります) 70KB 減った! 清水さんゴメンナサイ・・・
いらないソースを削る マルチプラットフォームなライブラリなので、 Webでは絶対に使わないコードがある。 #ifdefを使って頑張って削った 240KB 減った! 呼び出されない関数はリンクタイム最適化で捨てられるので、 無理に削る必要はない。
マクロをやめて関数にする ソースでCのマクロが多用されていた 同じ処理が色々なところに複製されている! マクロをやめて関数にしてみた 50KB 減った! inline関数でもいい感じにやってくれるかも
Emscriptenのバージョンを上げる 1.35.00 → 1.36.14 (sdk-incoming-64bit) 60KB 減った!
いろいろ減量してみた結果 1.2MB → 690KB gzip圧縮時 : 190KB いろいろ頑張ったけど、まだでかい・・・
ん? WebAssembly・・・? -s WASM=1 でビルド 無圧縮 asm.js比 サイズ 1/2!! gzip圧縮
asm.js比 サイズ 2/3!! 各ブラウザベンダー 早く対応してくれぇー!!