3 ms·
As you can already read in this thread (see [1]), this is due to static linking of the whole standard library. This limitation is known and solutions are being
by madez 11y ago
As you can already read in this thread (see [1]), this is due to static linking of the whole standard library. This limitation is known and solutions are being worked on.
[1] https://news.ycombinator.com/item?id=9552468 https://news.ycombinator.com/item?id=9552468
- steveklabnik 11y agoOnly one component of the three is really even being worked on, the other two are there: use LTO or dynamically link. Not linking to the standard library itself is behind a feature gate for now, but it should be relatively easy to stabilize in the future.
- mwcampbell 11y agoIt might also help to have the option of using libc's malloc rather than jemalloc.
- steveklabnik 11y agoCustom allocators are certainly a thing that's coming in the future. :)
- ChuckMcM 11y agoSo when I port the compiler to use newlib nano this goes away?
- madez 11y agoAs steveklabnik (see [1]) stated, there are 3 things missing: dynamic linking, link-time-optimization and the possibility to not link to the standard library. Each of these techniques will be able to reduce the size of Rust binaries. [1] https://news.ycombinator.com/item?id=9553366 https://news.ycombinator.com/item?id=9553366
- ChuckMcM 11y agoMy target is a Cortex M microcontroller so its always statically linked :-)
- georgerobinson 11y agoDoes Golang support dynamic linking? I think a Hello world binary in Go is about the same size? I know I'm sort of comparing apples with oranges here.
- swetland 11y agoGo hello world is larger, but it's static and includes the native Go libc equivalents instead of depending on glibc. $ size hello text data bss dec hex filename 1329045 25256 102376 1456677 163a25 hello That's a stripped Go 1.4.2 hello world (1941480 bytes unstripped).
- not_with_retard 11y agoYes, you can dynamically link by compiling Go with gccgo (https://golang.org/doc/install/gccgo https://golang.org/doc/install/gccgo).
- frik 11y agoHow? do you have tutorial/info about it? (The link above doesn't explain how.)
- georgerobinson 11y agoDoes Golang support dynamic linking? I think a Hello world binary in Go is about the same size? I know I'm not really comparing Apples with Apples here.