v
v copied to clipboard
v compiler get slower after `v up`
Describe the bug
I'm not sure if it's a bug or some misconfiguration... I discovered it pretty much occasionally.
For a while I noticed, that v <some_file.v> or v run | crun <some_file.v> get slower than usual. At first, I thought it was my machine but by coincidence I found it happens after v up
As an example, I will take "string interpolation" from https://play.vlang.io/ and current (d0e1f3a) version of https://github.com/vlang/gitly. See reproduction steps.
According to my observations, it must be v up since compiling with v_old.exe takes exact same amount of time as with v.exe
Any ideas? Do I miss something?
Expected Behavior
v up has no negative effects,
Compilation time stays the same or gets better.
Current Behavior
v up makes things worse.
Compilation time increases
Reproduction Steps
Download and unzip latest (in my case 0.3.4 046dd54, v_windows.zip) vlang.
Run v string_intpl.v with time measurements
Measure-Command {start-process v -argumentlist ".\string_intpl.v" -wait -NoNewWindow}
is the same as time v string_intpl.v
Here are the results of "fresh installation"

Version V 0.3.4 046dd54
Now run v up and now it's Current V version: V 0.3.4 5631e2f, timestamp: 2023-05-02 21:29:58 +0300
Compile with newer (updated) version.

Now it's 4x slower
With bigger script, it gets worse. Here's another example: compiling https://github.com/vlang/gitly with "fresh" and "updated" version.

After update

From 2 sec to 26
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.3.4 046dd54 and newer
Environment details (OS name and version, etc.)
OS: Windows 10 Pro x86_64 CPU: AMD Ryzen 7 4800H with Radeon Graphics (16) @ 2.900GHz GPU: NVIDIA GeForce RTX 2060 GPU: AMD Radeon(TM) Graphics Memory: 7720MiB / 32125MiB
Try disabling your antivirus service temporarily, while doing v self/v up, to see if that will affect the speed.
Ok, just a quick summary:
It turns out that "v up" clears thirdparty/tcc after update. This is also related to my other comment on https://github.com/vlang/v/issues/17888#issuecomment-1500256105
Running make.bat in CMD (not PowerShell!) after v up will fix the problem.
Thanks to @spytheman for helping me figure this out.
After some digging, I found this:
git_command: git clean --quiet -xdf --exclude v.exe --exclude cmd/tools/vup.exe
-x: This option tells Git to also remove ignored files.
-d: This option tells Git to also remove untracked directories.
So after this, there's always no thirdparty/tcc (and also no thirdparty/sqlite as explanation for https://github.com/vlang/v/issues/17888#issuecomment-1500256105)
In addition to this, vup.v tries to recompile v (v.exe self) and in case of success it just returns true (https://github.com/vlang/v/blob/master/cmd/tools/vup.v#L84) without calling app.make(vself)
All this leaves working V version without tcc, which indeed, is the reason for slow compilation time.
I think, git clean need another --exclude. Something like this:
git clean --quiet -xdf --exclude v.exe --exclude cmd/tools/vup.exe --exclude thirdparty/tcc/*
Maybe also add thirdparty/tcc/.gitkeep ?