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
laketowncr
Search
kubo39
August 29, 2015
Programming
0
350
laketowncr
kubo39
August 29, 2015
Tweet
Share
More Decks by kubo39
See All by kubo39
hookingsharedelflibs
kubo39
0
81
Other Decks in Programming
See All in Programming
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
250
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
620
NPOでのDevinの活用
codeforeveryone
0
630
Systèmes distribués, pour le meilleur et pour le pire - BreizhCamp 2025 - Conférence
slecache
0
120
エラーって何種類あるの?
kajitack
5
330
Benchmark
sysong
0
280
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
350
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
260
Goで作る、開発・CI環境
sin392
0
190
ペアプロ × 生成AI 現場での実践と課題について / generative-ai-in-pair-programming
codmoninc
0
230
Hypervel - A Coroutine Framework for Laravel Artisans
albertcht
1
110
ReadMoreTextView
fornewid
1
490
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Six Lessons from altMBA
skipperchong
28
3.9k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Stop Working from a Prison Cell
hatefulcrawdad
270
20k
Transcript
Laketowncr kubo39
Crystal binary size 619KB to 704bytes • Repo: https://github.com/kubo39/tinycr
619KB → 528KB • --release build 632962bytes →540050bytes
528KB → 454KB • Use strip command 540050bytes → 463944bytes
454KB → 10592bytes • --prelude=empty prelude.crではなくemtpy.crをロードする 必要なライブラリは適宜自前でrequire • https://github.com/kubo39/tinycr/commit/c0d 2e519902fa7a9cee57a004acda656f3e10e8f
- libpcre依存とか消せる - この時点でインラインアセンブラ書いたりしてるが あまり意味ない
10592bytes → 6272bytes • to_unsafe Stringクラスのunsafeを自前で定義しなおす • https://github.com/kubo39/tinycr/commit/63d 5c8be5eabdf268509053aef8525064afb3eeb •
この時点でlibc以外の依存がなくなった
6272bytes →5480bytes • eglibc捨ててmusl libcに静的リンク • https://github.com/kubo39/tinycr/commit/973 284df2cd59e25245858cc79c38e3097770f6b • とうとう依存がなくなった!!
ldd helloでも確認
5480bytes → 5400bytes • --gc-sections - リンク時に不要なセクション削除 • https://github.com/kubo39/tinycr/commit/d4c 568bda484c1b7c1a9a35f02b08a4cad7fc15c
5400bytes → 5360bytes • エントリポイントをmainにする 普通にやるとsegvるのでexit(2)で終了 • https://github.com/kubo39/tinycr/commit/afcc 7aca613ce59b171b6850f1f4e130fba6e44c
5360bytes →704bytes • というかもうlibc依存する処理一切ないよね、という わけで--nostdlib渡す • https://github.com/kubo39/tinycr/commit/e2b 77fe1855aa36579459bb8f5096eae93eed4ca • これでもちゃんと実行できます