Performance issue without -prod
option
#20947
Replies: 2 comments 8 replies
-
In default, V use tcc as the C compiler, which compile speed is very fast, but the generated binary is not well optimization. So, for develop process, you need a faster compile time and debug, you'd better use default tcc compiler. Maybe you can try with: v . -cc gcc or v . -cc clang |
Beta Was this translation helpful? Give feedback.
-
From time to time, there are such "speed threads" of V versus other languages that come up. Often the situation is the person is not aware of different flags and compiler options that they can use or the way in which the code can be written or algorithm used can be changed. Possibly some links to check: (build) Compilation commands for the V language |
Beta Was this translation helpful? Give feedback.
-
I was doing some Advent of Code in order to learn some V, when I noticed that it was taking a long time to run the program, so i decided to rewrite the same program in Go (the program is just using some slices and ranging over them, so it should be fair to compare them in this way). Go was 6x faster than V! After some browsing, I tried to compile with the
-prod
option and things turned around: now V was more than 2x faster than Go. So the question is: why is there such a difference (more than 12x) from the develop build and the production build?This is the output of the benchmark I make (if you want to see the sources I will post them):
I understand that the default build is much faster to compile, but considering that the default took 0.3s to compile while the production one took 4.0s, I don't think it's a fair tradeoff for 12x slower execution times.
So the second question is: is there a way to mitigate this problem and find a middleground?
Thanks for your time.
Beta Was this translation helpful? Give feedback.
All reactions