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
310
laketowncr
kubo39
August 29, 2015
Tweet
Share
More Decks by kubo39
See All by kubo39
hookingsharedelflibs
kubo39
0
75
Other Decks in Programming
See All in Programming
GitLab CI/CD で C#/WPFアプリケーションのテストとインストーラーのビルド・デプロイを自動化する
hacarus
0
290
Polars入門
daikikatsuragawa
1
170
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
1
360
Ruby Function Composition
bkuhlmann
1
340
障害対応を起点としたもっといい開発と運用のサイクル作りのためにできること / Hatena Enginner Seminar #29
polamjag
0
380
デフォルトにして至高、RubyMineの大好きな所
ruzia
0
800
PostmanでAPIの動作確認が楽になった話
h455h1
0
180
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
550
VS Code をプロダクトにどう取り込むか
onomax
1
710
Amazon SQSコンシューマー疎結合への旅 - 出張! #DevelopersIO IT技術ブログの中の人が語る勉強会 #3
quiver
0
310
PHPはいつから死んでいるかの調査
chiroruxx
2
420
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
120
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
79
43k
Happy Clients
brianwarren
92
6.4k
Statistics for Hackers
jakevdp
790
220k
The Brand Is Dead. Long Live the Brand.
mthomps
49
29k
The Mythical Team-Month
searls
216
42k
How to train your dragon (web standard)
notwaldorf
75
5.2k
Faster Mobile Websites
deanohume
300
30k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
660
120k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
245
20k
Optimizing for Happiness
mojombo
370
69k
Building Effective Engineering Teams - LeadDev
addyosmani
31
1.9k
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 • これでもちゃんと実行できます