-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V should warn if -prod used and only tcc is available. #9261
Comments
What C compiler are you using? |
@highfestiva could you also run current nbody written for Go on your machine with the same setup as you did with V's nbody? The Go benchmark you referenced is very old and I suspect it wasn't run on your machine (both HW-wise and SW-wise). So it's far from being comparable. For actually curated and current benchmarks (which I personally find very informative and useful) I'd strongly recommend looking at https://github.com/kostya/benchmarks (though they use only V releases and not the latest master branch which might slightly vary). |
@dumblob My computer is ok: $ time /c/prog/go/bin/go run nbody.go 50000000
-0.169075164
-0.169059907
real 0m6.136s
user 0m0.047s
sys 0m0.187s I.e. 4% faster than the computer @ language shootout. |
Yes, but it's not being used for
This can be much more than "just 3.3 magnitudes" 😉. And this is a sensible computer (i.e. standard HW and standard SW equipment). So thanks for the actual measurement on your machine! But fun aside, the problem seems to be really the compiler as noted above. @ntrel any hints? Maybe simply installing any Visual Studio (assuming Windows) or GCC (assuming any platform) should solve it. |
When benchmarking you should benchmark the binary, not Most of |
If there's no other C compiler installed, tcc has to be used, it does do some light optimization. A warning message probably should be printed though. |
With correct measurement I get expected results:
|
Aha, so I need to install a C compiler to get some performance under Windows! Perhaps that should be mentioned so it's not missed. Many Windows users might do like me and completely miss this. What is the recommended C compiler for Windows 10? @medvednikov Note that it takes over four minutes to run with |
msvc is probably the best for windows specific code, but it is a disk and memory hog. You can get the latest version of gcc for Windows from http://winlibs.com/ |
I agree |
I get these results with
|
Although a lot better, I still found V's performance only about 2% faster than the go implementation (got the same performance from mingw-64 as msvc). The only way I see V being an alternative to Rust (for me, and probably many like me) is if its performance is on par. Are there plans to enhance performance? (Rust n-body is twice as fast as V and Go.) |
@highfestiva there are basically no optimizations in the compiler (as it's still pre-alpha quality and everybody works on correctness first). But feel free to check out some opened issues regarding "low level" performance: #1839 |
@highfestiva V compiles to C, so the perf should be the same. On this page C/C++ are 25% slower than Rust. So it's either a different algorithm or a bug/performance issue in vlib, which should be fixed. |
V version: V 0.2.2 5d653a3
OS: Windows 10
What did you do?
v -prod run examples/nbody.v
What did you expect to see?
I had hoped to see improved performance compared to the original go implementation.
What did you see instead?
A three (3!) magnitudes slower execution time than the original. Is this to be expected? I thought v was performant, especially compared to a language with a runtime, or did I miss something?
The text was updated successfully, but these errors were encountered: