8000 Compiler optimizations by tarkah · Pull Request #86 · tarkah/tickrs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Compiler optimizations #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2021
Merged

Compiler optimizations #86

merged 2 commits into from
Feb 22, 2021

Conversation

tarkah
Copy link
Owner
@tarkah tarkah commented Feb 22, 2021

@miraclx LTO appears to reduce binary size from 11MB to 7.8MB on Linux. No noticeable difference on the inlined function, but maybe it was already getting inlined or is immaterial.

@tarkah tarkah merged commit 89d149b into master Feb 22, 2021
@tarkah tarkah deleted the compile-optimizations branch February 22, 2021 23:20
@miraclx
Copy link
Contributor
miraclx commented Feb 23, 2021

Probably inlined it by default with the function being small. https://stackoverflow.com/a/37639889/9806233

@miraclx
Copy link
Contributor
miraclx commented Feb 23, 2021

Messed around with some things, and was able to get the binary size to as low as 1856 kbytes (1.9M) first with opt_level='z' (5.1M) on the release profile and then finally using upx to compress the binary with the lzma format.

$ du -sh 0.13.1*
10252   11M     0.13.1
6224    6.1M    0.13.1_stripped
7892    7.8M    0.13.1_lto
5612    5.5M    0.13.1_lto_stripped
5124    5.1M    0.13.1_opt_level
2340    2.3M    0.13.1_opt_level_upx_1
2320    2.3M    0.13.1_opt_level_upx_9
2312    2.3M    0.13.1_opt_level_upx_best
1904    1.9M    0.13.1_opt_level_upx_brute
2076    2.1M    0.13.1_opt_level_upx_brute_1
1904    1.9M    0.13.1_opt_level_upx_brute_9
1856    1.9M    0.13.1_opt_level_upx_lzma
2028    2.0M    0.13.1_opt_level_upx_lzma_1
1856    1.9M    0.13.1_opt_level_upx_lzma_9
1896    1.9M    0.13.1_opt_level_upx_ultra_brute

I'm sure there's gonna be a cost somewhere that I can't investigate right now, but it's good to know it gets that low without doing much to tweak the actual code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0