Performance comparison of various compilers

2021-05-23 Thread shirleyquirk
> I'm surprised that PR was accepted, this comparison doesn't make any sense > now. I agree, I regret the oversight of leaving them turned on. You should submit a pr changing run.bat to something more appropriate, and edit the D while you're at it. Except the points are all made up, treeforms v

Performance comparison of various compilers

2021-05-23 Thread gavr
By the way, other languages still use double, not float. The C++ version generally only has -O2, while nim -d:danger-d:lto-d:intpow-d:quake --passC:" \- march=native". Yea even march=native. I'm surprised that PR was accepted, this comparison doesn't make any sense now.

Performance comparison of various compilers

2021-05-23 Thread gavr
DMD is the reference version of the D compiler, it has no optimizations and has the highest compilation speed. DMD is based on 2 other compilers, GDC (from GCC) and LDC (LLVM). Obviously, DMD will be the slowest.

Performance comparison of various compilers

2021-05-23 Thread cantanima
> Why to complain? If that's directed at me, I'm not complaining. I'm trying to understand. When someone publishes that his implementation is 50+% faster than C, as @treeform has in the GitHub repo, it's worth looking into the reasons. More generally, it's not fair to say that one should compar

Performance comparison of various compilers

2021-05-23 Thread Sixte
why to complain? On the repo, Nim(+GCC) are the fastest. Plain C is a bit slower, C++ dito. Crystal is a surprise, almost as fast as C++. I got 570 ms with --d:debug, 68 ms with release and 62 ms with danger. Very nice.

Performance comparison of various compilers

2021-05-23 Thread shirleyquirk
@cantanima clang on linux is slower than gcc with the upstream (edin) code. for me it's 78ms (vs 74ms for c++ and 62ms for nim/gcc) but the error bars on those numbers is like +/-10ms @kcvinu the D commandline is `dmd RayTracer.d -m64 -O -inline -release -noboundscheck` and i'm getting 400ms or

Performance comparison of various compilers

2021-05-23 Thread kcvinu
Try D with DMD compiler. It is the fastest I think. I have same project in Nim & D. When I hit run button, D project compiles and run first.

Performance comparison of various compilers

2021-05-23 Thread cantanima
Could there be something platform- or compiler-dependent going on? I tried this on MacOS 10.15.7 with Nim 1.4.4 and get 141ms for Nim vs. 127ms for C++. I should perhaps note that compiling the Nim code with `-d:lto` gave `clang: error: invalid linker name in argument '-fuse-ld=lld'`. Changing t

Performance comparison of various compilers

2021-05-23 Thread shirleyquirk
I don't know what the rules are, but shouldn't you count all the included libraries in the SLOC? I also think using float32 is 'cheating' I love `push noinit,checks:off` On my machine, with devel, running `sh run.bat` I get 100 ms for treeform/raytracer and 68 ms for edin/raytracer (after remo

Performance comparison of various compilers

2021-05-23 Thread treeform
I was able to cut down the SLOC significantly down to 264 lines while still looking like normal nim similar in style I use in pixie and vmath. This make Nim both the fastest and the shortest, winning the benchmark game.

Performance comparison of various compilers

2021-03-18 Thread shirleyquirk
i gave up trying to do simple modifications and just refactored the bloody thing and got it down to 54ms vs 74ms for c++. with some extra cheaty optimizations (integer pow, quake invsqrt, and -march=native) that comes down to 37ms on my machine, the ma

Performance comparison of various compilers

2021-03-17 Thread marcomq
Thats great! Can someone create a PR for this? Or just post the latest running version of faster code here so that someone can create a PR? Currently there is only the PR with the compiler flags. I would also recommend to keep it as double and not float, as the C code and all other codes are usi

Performance comparison of various compilers

2021-03-16 Thread rockcavera
Congratulations. This shows that Nim can be as fast as C. Your current code, here, runs, on average, 86ms, against 71ms of C.

Performance comparison of various compilers

2021-03-16 Thread mratsim
> Why is it using float64 everywhere? This is computer graphics not > computational physics! Changing everything to use float32 I get float64 vs float32 is a huge debate in the raytracing community even in Academia. A naive raytracer can likely use float64, a raytracer reorged using something s

Performance comparison of various compilers

2021-03-16 Thread xigoi
I'm surprised they included many modern systems languages, but not Rust.

Performance comparison of various compilers

2021-03-15 Thread alexeypetrushin
Is it "faster" than C with inline? :) Faster than C version written with functions.

Performance comparison of various compilers

2021-03-15 Thread treeform
ElegantBeef had this idea to put inline around every functions using `{.push inline.}` and that really put everything into over drive: name ... min time avg timestd dv runs ray trace . 76.682 ms 79.987 ms±6.30

Performance comparison of various compilers

2021-03-15 Thread treeform
I tried your idea with the exists flag. But it made it 6ms slower: name ... min time avg timestd dv runs ray trace 116.443 ms123.428 ms±9.589x40 Run

Performance comparison of various compilers

2021-03-15 Thread treeform
What speeds do you get now?

Performance comparison of various compilers

2021-03-15 Thread shirleyquirk
`template isNil(t:Thing):bool = not t.exists` and added an `exists:bool` to Thing

Performance comparison of various compilers

2021-03-15 Thread treeform
How do you deal wit the Thing nil checks everywhere?

Performance comparison of various compilers

2021-03-15 Thread shirleyquirk
changing Thing to be an object and I get 17ms, vs 69ms for the c++ example, compiled with -d:danger -d:lto --gc:arc

Performance comparison of various compilers

2021-03-15 Thread treeform
Why is it using float64 everywhere? This is computer graphics not computational physics! Changing everything to use float32 I get: name ... min time avg timestd dv runs ray trace 137.195 ms140.204 ms±4.783

Performance comparison of various compilers

2021-03-15 Thread treeform
Here is what I looked at before I got bored: Nim slower then C? How is that possible? Lets see CPU time [ms] 2018.0 Run Oh compiled debug mode Nim, with C -O3 ... that will not do. Debug mode inserts hu

Performance comparison of various compilers

2021-03-15 Thread treeform
Man I totally forgot about --gc:arc. Adding that yields more speed: name ... min time avg timestd dv runs ray trace 110.665 ms119.449 ms±9.403x41 Run

Performance comparison of various compilers

2021-03-15 Thread Clonk
@mratsim made a Ray Tracer implementation that is efficient @Vindaar also made one : You could take a look at how they did it to see what you can improve, their code is generally

Performance comparison of various compilers

2021-03-15 Thread Yardanico
They use that

Performance comparison of various compilers

2021-03-15 Thread miran
Without even looking at the code: if they use that `run.bat` for running the Nim example, they need `-d:release` or `-d:danger` there.

Performance comparison of various compilers

2021-03-15 Thread g_lasso
I didn't look at the code, but the run.bat is not optimized for release. nim c -r RayTracer.nim Run I created this PR in the repository.

Performance comparison of various compilers

2021-03-15 Thread FabienPRI
Hi, please see I think there are several benchs of this type but in this one there is nim but not really well placed : comments says it is not optimized for nim, but how to make it quicker? Just a question, just want to se