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
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
1.7k
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
55
37k
新卒PdEのリアル
ryu1013
1
480
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
350
自分的「カンファレンスの楽しみ方」
syumai
0
200
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
120
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
300
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
240
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
7
3.6k
AIを上手に使っていこうとしたら越境せざるを得なくなった話 〜実践1年で見えた境界を越えなければならない理由と進め方〜 / Crossing borders with AI
tomoyakitaura
4
1.1k
アクセシビリティから考える情報設計
high_g_engineer
0
350
Featured
See All Featured
Abbi's Birthday
coloredviolet
3
9.9k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Building an army of robots
kneath
306
46k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
330
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
65k
エンジニアに許された特別な時間の終わり
watany
108
250k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.2k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
250
Are puppies a ranking factor?
jonoalderson
2
3.9k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
190
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
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!! 各ブラウザベンダー 早く対応してくれぇー!!