While looking for data comparing Rust and C, I went to the benchmarkgame site and tried it myself, and it turned out different from the specified results.(rust vs c clang)
https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/rust-clang.html
Each source code is as follows, and it was executed through the compile command shown at the bottom of the source code.
However, Rust ran the cargo in the nightly version.
Below is the result of the compiled result measured by time on my pc.
The reason for this result is that I compile incorrectly? Or is it normal for these results to come out in the first place?
I am using intel i7 10700k, 16gb ram.
>Solution :
The screenshot shows that Rust is being compiled in debug mode, which will make for a poor benchmark. Use --release to build it with full optimizations.
time cargo run --release 21
Better yet, use the same build command they did in case the other options are important:
/opt/src/rust-1.55.0/bin/rustc -C opt-level=3 -C target-cpu=ivybridge --C codegen-units=1 -L /opt/src/rust-libs binarytrees.rs -o binarytrees.rust-5.rust_run

