Summary: Rustc 17.7s, Go 13.6s, Clang 11.2s, GCC 10.4s.
Note that the versions in Clang, G++ and Go are rendering the word "Go"
while that the Rust version is rendering a word bigger "Rust"
System: x86_64 GNU/Linux 3.8.0-30-generic
Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz
4 GB RAM
I've used Rust trunk, Go 1.1.2:
$ gcc --version
gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
$ clang --version
Ubuntu clang version 3.2-1~exp9ubuntu1 (tags/RELEASE_32/final) (based on
LLVM 3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ go version
go version go1.1.2 linux/amd64
$ rust --version
rust 0.8 (b6fe27c 2013-09-24 07:06:09 -0700)
host: x86_64-unknown-linux-gnu
* * *
$ rustc --opt-level=3 raytracer.rs -o rayt-rust
$ time ./rayt-rust > rayt-rust.ppm
real 0m17.746s
user 0m17.332s
sys 0m0.404s
$ go tool 6g raytracer.go && go tool 6l -o rayt-go raytracer.6 && rm
raytracer.6
$ time ./rayt-go > rayt-go.ppm
real 0m13.664s
user 0m13.656s
sys 0m0.008s
$ clang -O3 -lm raytracer.cpp -o rayt-clang
$ time ./rayt-clang > rayt-clang.ppm
real 0m11.199s
user 0m11.188s
sys 0m0.004s
$ g++ -O3 -lm raytracer.cpp -o rayt-g++
$ time ./rayt-g++ > rayt-g++.ppm
real 0m10.411s
user 0m10.404s
sys 0m0.000s
El 24/09/13 14:52, Huon Wilson escribió:
On 24/09/13 16:18, John Mija wrote:
Since a post in HN about a raytracer into a business card, a guy built
the implementation in Go:
https://groups.google.com/forum/#!topic/golang-nuts/mxYzHQSV3rw
The C++ version: https://gist.github.com/kid0m4n/6680629
The Go version: https://github.com/kid0m4n/gorays
Performance (2.2 Ghz Quad Core (2675QM), 16 GB RAM, OX 10.9, Go 1.1.2):
C++ version: 11.803 s
Go version: 28.883 s
* * *
It would be interesting if somebody with experience in Rust could
build the version in Rust to compare the speed.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
I bit: https://github.com/huonw/card-trace
Summary: Clang 13.8s, GCC 17.9s, Rustc 17.9s.
(1.9GHz 3517U, 8 GB, linux. GCC: 4.8.1, Clang: 3.3, rustc: 18e3bcd
2013-09-23 23:46:05 -0700.)
I just did essentially a transliteration of the C++ into (reasonably
idiomatic) Rust, I imagine one could make it faster with some effort,
but that would be cheating (at least, it would then become a test of
*my* micro-optimisation ability, rather than that of the compilers). It
appears that clang vectorises/uses SSE directly more eagerly than either
gcc or rustc from some quick poking with perf.
(I don't have Go on this computer to compare; although I imagine the
only comparison of interest would be with gccgo, since "normal" go
doesn't optimise anywhere near as much as LLVM does.)
Huon
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev