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
670
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
AIエージェント時代のコードレビューを設計する
nogu66
6
2.6k
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
130
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
520
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
360
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
190
Building an Out-of-Order CPU
latte72
1
750
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
190
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.2k
Family mrubyの進捗
kishima
1
110
高専キャリア LT 発表内容
crysta1221
6
5.6k
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Ruling the World: When Life Gets Gamed
codingconduct
0
330
First, design no harm
axbom
PRO
2
1.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
350
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Producing Creativity
orderedlist
PRO
348
41k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
310
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
The untapped power of vector embeddings
frankvandijk
2
1.9k
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!! 各ブラウザベンダー 早く対応してくれぇー!!