Last active
June 15, 2018 16:48
-
-
Save seven1m/830b5067a8784f9f570152063de03f52 to your computer and use it in GitHub Desktop.
I was interested to see static binary size difference between Crystal and Rust.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ ~/Desktop cat hello_crystal.cr | |
puts "hello world" | |
➜ ~/Desktop cat hello_rust.rs | |
fn main() { | |
println!("hello world"); | |
} | |
➜ ~/Desktop crystal --version | |
Crystal 0.25.0 [7fb783f7a] (2018-06-11) | |
LLVM: 4.0.0 | |
Default target: x86_64-unknown-linux-gnu | |
➜ ~/Desktop rustc --version | |
rustc 1.25.0 (84203cac6 2018-03-25) | |
➜ ~/Desktop crystal build hello_crystal.cr --release --static | |
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libevent.a(evutil.o): In function `test_for_getaddrinfo_hacks': | |
(.text+0x300): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking | |
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libevent.a(evutil.o): In function `evutil_getaddrinfo_common_': | |
(.text+0x1b3b): warning: Using 'getprotobynumber' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking | |
(.text+0x1c04): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking | |
➜ ~/Desktop rustc -O hello_rust.rs | |
➜ ~/Desktop ls -lh | |
-rwxr-xr-x 1 tim tim 2.4M Jun 15 11:44 hello_crystal | |
-rw-r--r-- 1 tim tim 19 Jun 15 11:34 hello_crystal.cr | |
-rwxr-xr-x 1 tim tim 4.5M Jun 15 11:44 hello_rust | |
-rw-r--r-- 1 tim tim 43 Jun 15 11:36 hello_rust.rs | |
➜ ~/Desktop strip hello_crystal hello_rust | |
➜ ~/Desktop ls -lh | |
-rwxr-xr-x 1 tim tim 1.4M Jun 15 11:45 hello_crystal | |
-rw-r--r-- 1 tim tim 19 Jun 15 11:34 hello_crystal.cr | |
-rwxr-xr-x 1 tim tim 443K Jun 15 11:45 hello_rust | |
-rw-r--r-- 1 tim tim 43 Jun 15 11:36 hello_rust.rs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment