Rust minimal compiled program size

exebook
fn main() {
    println!("hello");
}

This program compiles 600 ms and the resulting binary is 600KB in size. Why is that? I am just trying Rust, and comparing it to C. C would compile similar program 10 times faster and the binary output will be 100 times smaller. So why is that?

fjh

The executable size is mostly because rust's standard library is statically linked in by default. Try compiling with rustc -O -C prefer-dynamic and you should get a binary that's comparable to the C version.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Rust minimal compiled program size

From Dev

Do Rust lifetimes influence the semantics of the compiled program?

From Dev

Rust and C linking problems with minimal program and no_std

From Dev

minimal size for a rectangle in style

From Dev

TCP/IP minimal size

From Dev

Install minimal Rust setup on Debian

From Dev

Does a program, in general, have a larger file size when compiled with an IDE than saved by a normal text editor?

From Dev

Decompiling a compiled program with Go

From Dev

if 0 is compiled in c program

From Dev

uninstall program compiled with make

From Dev

QML window minimal size with frame

From Dev

Haskell compiled program giving a segfault

From Dev

Compiled Python writing to Program Files

From Dev

How this program compiled and run successfully?

From Dev

C++ program can not be compiled

From Dev

Undefined reference to "main" in minimal C program

From Dev

Including only minimal Qt library with a program

From Dev

Minimal Qt program makes memory leak

From Dev

Minimal stack size for Linux clone call?

From Dev

Using a configuration file with a compiled Go program

From Dev

Taylor Series Calculating Program in C compiled with GCC

From Dev

Program compiled with gfortran, how to recompile with ifort?

From Dev

Distribute a program compiled with MinGW g++

From Dev

How to know a program was compiled with ALWNULL(*USRCTL)

From Dev

Why does a linux compiled program not work on Windows

From Dev

Finding dependencies for a compiled C++ program

From Dev

Is a library compiled every time a program invokes it?

From Dev

Program compiled with gfortran, how to recompile with ifort?

From Dev

compiled program not executing, just has blinking cursor

Related Related

HotTag

Archive