kidoman / rays

Ray tracing based language benchmarks
https://kidoman.com/programming/go-getter.html
95 stars 23 forks source link

Benchmark: Julia #14

Closed jakebolewski closed 10 years ago

jakebolewski commented 10 years ago

Julia (latest 0.2-prerelease) single threaded implementation. Julia can launch multiple processes but the startup overhead is too high for this benchmark. Startup overhead (~2 secs) hurts performance in this test. However, Julia is competative with the GO and Java implementations (at least on my computer).

Julia Startup cost (load and JIT file)

rays/juliarays [master●] » time julia Rays.jl > test.ppm julia Rays.jl > test.ppm 2.13s user 0.03s system 99% cpu 2.170 total

Julia (512 x 512) Single Threaded

rays/juliarays [master●] » time julia 512 512 Rays.jl > test.ppm julia Rays.jl > test.ppm 14.95s user 0.25s system 99% cpu 15.231 total

Java (512 x 512) Single Threaded

rays/javarays [master●] » time java rays.Raycaster 512 512 1 > test.ppm java rays.Raycaster 512 512 1 > test.ppm 13.75s user 0.35s system 100% cpu 13.982 total

Java (512 x 512) Multi Threaded

java rays.Raycaster 512 512 2 > test.ppm 23.34s user 0.81s system 190% cpu 12.670 total

Go (512 x 512) Multi Threaded

rays/gorays [master●] » time ./main 512 512 1 > test.ppm
./main 512 512 1 > test.ppm 14.51s user 0.02s system 198% cpu 7.322 total

C++ (512 x 512) Single Threaded

rays/cpprays [master●] » time ./cpprays 512 512 1 > test.ppm ./cpprays 512 512 1 > test.ppm 5.80s user 0.00s system 99% cpu 5.815 total

C++ (512 x 512) Multi Threaded

rays/cpprays [master●] » time ./cpprays 512 512 2 > test.ppm ./cpprays 512 512 2 > test.ppm 6.04s user 0.00s system 198% cpu 3.042 total

kidoman commented 10 years ago

We should work to get this merged in asap. Have been eyeing Julia for a long time, and this is a good opportunity to get started. Few things though:

I will open a separate issue to talk about the generic stuff

jakebolewski commented 10 years ago

Did the sky gradient change? I changed the color to match the new benchmark but the gradient is off compared to the other implementations (a bit darker). The original benchmark outputs matched.

I'm getting ~50s for the new benchmark on my computer, about 2.5x slower than the optimized c++ version.

kidoman commented 10 years ago

Please have a look at the Go version. I have implemented some changes

jakebolewski commented 10 years ago

I based the camera position off the c++ version and everything now matches up. I also added suggestions from the julia-users mailing list. final version is ~2x slower than the single threaded SSE c++ version on my computer (49 secs vs. 24secs).

kidoman commented 10 years ago

Have a look at https://github.com/kid0m4n/rays/issues/11

I have made these corrections in the Go version, but haven't had time yet to do the same on the C++ version

Also, I have introduced a new way of invoking the benchmarks so that frameworks/languages which have a high startup time don't get unnecessarily penalized

jakebolewski commented 10 years ago

Everything looks good now. You might want to add a clamping function for updating the RGB pixel values. Higher intensities cause overflow and some of the spheres have black dots around the lightsource reflection.

kidoman commented 10 years ago

Thanks

I will merge this asap