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
設計やレビューに悩んでいるPHPerに贈る、クリーンなオブジェクト設計の指針たち
panda_program
6
1.8k
童醫院敏捷轉型的實踐經驗
cclai999
0
210
ペアプロ × 生成AI 現場での実践と課題について / generative-ai-in-pair-programming
codmoninc
0
210
0626 Findy Product Manager LT Night_高田スライド_speaker deck用
mana_takada
0
130
Team operations that are not burdened by SRE
kazatohiei
1
290
Code as Context 〜 1にコードで 2にリンタ 34がなくて 5にルール? 〜
yodakeisuke
0
120
関数型まつりレポート for JuliaTokai #22
antimon2
0
160
ニーリーにおけるプロダクトエンジニア
nealle
0
700
WebViewの現在地 - SwiftUI時代のWebKit - / The Current State Of WebView
marcy731
0
110
Go1.25からのGOMAXPROCS
kuro_kurorrr
1
840
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
620
来たるべき 8.0 に備えて React 19 新機能と React Router 固有機能の取捨選択とすり合わせを考える
oukayuka
2
880
Featured
See All Featured
The Language of Interfaces
destraynor
158
25k
Scaling GitHub
holman
459
140k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
It's Worth the Effort
3n
185
28k
A better future with KSS
kneath
239
17k
Producing Creativity
orderedlist
PRO
346
40k
Writing Fast Ruby
sferik
628
62k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.4k
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 • これでもちゃんと実行できます