4 ms·
I am not much concerned with hyper optimizations, but I was curious how OCaml would fair with the initial, simple steps, before things get crazy. But I opted fo
by abathologist 3y ago
I am not much concerned with hyper optimizations, but I was curious how OCaml would fair with the initial, simple steps, before things get crazy. But I opted for a more complex program:
(\* t.ml \*)
let () = print_endline "Hello, World!"
Then just doing a standard compilation and a strip:
$ ocamlopt -o t t.ml && ls -l -h t | cut -d " " -f5
1.5M
$ strip t && ls -l -h t | cut -d " " -f5
356K
$ ./t
Hello, World!
I may be overlooking something, and would be interested to learn what if so, but I was surprised we got a result smaller than the rust binary in the first instance.
- estebank 3y agoIt is interesting that before stripping the size of the Rust version is bigger, but after only stripping the size of the OCaml version is bigger. It'd be nice to try and see what the "extra" info that Rust ships by default is.
- abathologist 3y agoYeah, I thought the same!
- Voklen 3y agoI believe the extra size before stripping is because Rust ships the standard library with debug symbols included by default (for now) Source: https://kobzol.github.io/rust/cargo/2024/01/23/making-rust-binaries-smaller-by-default.html https://kobzol.github.io/rust/cargo/2024/01/23/making-rust-b... HN discussion: https://news.ycombinator.com/item?id=39112486 https://news.ycombinator.com/item?id=39112486
- davidhyde 3y agoThe author got 400 bytes, not 400KB though.