-
-
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 with tcc is 70x slower than using gcc with -prod
#23095
Comments
Where is the What command lines did you use? |
I install v into ~/work/v
The nobody.v ia part of the examples
I navigate to the folder
cd ~/work/v/examples/
Then I run
-prod -cc gcc nbody.v
and then test it with
time ./nbody
I compared using the same process except using
v nbody.v
which is slower
…On Sat, Dec 7, 2024 at 1:26 PM JalonSolov ***@***.***> wrote:
Where is the nbody code you're compiling?
What command lines did you use?
—
Reply to this email directly, view it on GitHub
<#23095 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2NZI2OQ45WJ2VBHL444JL2ENRZPAVCNFSM6AAAAABTGPKIAGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRVGMYTKNBVGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I may be wrong. But I think you're confusing things a bit. There are a few different types of V compilation, for example, native, TCC, and GCC. TCC tends to be fast to compile, however, it does not generate as optimized machine code as GCC. To compile using GCC, try using the tag |
Correct. This doesn't have anything to do with V, but with the C compiler used on the backend. Compiling without Compiling with With the optimizations, I'm not at all surprised that the code is a lot faster when compiled with Lastly, V does have an actual
so it won't even compile to test against the C compiled versions. Comparing the C versions against, each other, though, I get this on my machine:
|
I think the confusion stems from the use of the term V has a native backend, but it is incomplete. You can choose it with It also downloads and uses a tcc executable by default, since it is a small and fast C compiler, which however does not optimise. Imho the title should be changed to reflect that, and the word native should be removed, replaced by |
-prod
Title changed. Closing. |
Thank you for let me know I missed the -prod on the command line
both options to compile and run times, are very close now
compile nbody with gcc -prod
real *0m4.129s *
user 0m3.941s
sys 0m0.209s
Gcc prod runtime of nbody
real *0m3.040s *
user 0m3.038s
sys 0m0.002s
compile nbody with v -prod
real * 0m4.121s *
user 0m3.948s
sys 0m0.188s
v prod runtime of nbody
real *0m3.467s *
user 0m3.451s
sys 0m0.004s
…On Sat, Dec 7, 2024 at 4:52 PM JalonSolov ***@***.***> wrote:
Title changed. Closing.
—
Reply to this email directly, view it on GitHub
<#23095 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2NZI4UN6JQXD6UTYP2TSD2EOJ4XAVCNFSM6AAAAABTGPKIAGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRVGM3DGMZYGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Describe the bug
native v is 70x slower than using gcc
Reproduction Steps
using gcc
cd ./vc && git clean -xf && git pull --quiet
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
cc -std=gnu99 -w -o v1.exe ./vc/v.c -lm -lpthread
./v1.exe -no-parallel -o v2.exe cmd/v
./v2.exe -nocache -o ./v cmd/v
rm -rf v1.exe v2.exe
Your
tcc
is working. Good - it is much faster at compiling C source code.V has been successfully built
V 0.4.8 11dc600
starting to compile nbody
-0.169075164
-0.169059907
real 0m3.136s
................................
using native v
cd ./vc && git clean -xf && git pull --quiet
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
cc -std=gnu99 -w -o v1.exe ./vc/v.c -lm -lpthread
./v1.exe -no-parallel -o v2.exe cmd/v
./v2.exe -nocache -o ./v cmd/v
rm -rf v1.exe v2.exe
Your
tcc
is working. Good - it is much faster at compiling C source code.V has been successfully built
V 0.4.8 11dc600
starting to compile nbody
-0.169075164
-0.169059907
real 1m22.120s
user 1m21.749s
sys 0m0.209s
Expected Behavior
v compiler shoudl be as fast as gcc
Current Behavior
V compiler 70X slower
Possible Solution
unknown
Additional Information/Context
No response
V version
Current V version: V 0.4.8 11dc600
Environment details (OS name and version, etc.)
V full version: V 0.4.8 e32e9f7.11dc600
OS: linux, Ubuntu 24.10
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
getwd: /home/ghs/bin
vexe: /home/ghs/work/v/v
vexe mtime: 2024-12-07 19:23:51
vroot: OK, value: /home/ghs/work/v
VMODULES: OK, value: /home/ghs/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.45.2
Git vroot status: weekly.2024.49-34-g11dc6005
.git/config present: true
CC version: cc (Ubuntu 14.2.0-4ubuntu2) 14.2.0
emcc version: N/A
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Huly®: V_0.6-21533
The text was updated successfully, but these errors were encountered: