Last active
December 4, 2021 02:43
-
-
Save olegchir/43f6d6983e6bd44bdeb1478668f53a45 to your computer and use it in GitHub Desktop.
Revisions
-
olegchir revised this gist
Dec 4, 2021 . 1 changed file with 27 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,13 @@ I want to check claims that V is very slow, by comparing it with Golang: <https://christine.website/blog/v-vaporware-2019-06-23> # Assumptions The test from the source article uses 1.2 million lines. V can't compile this number of lines. Go used 25G RAM on my machine, and was compiling it ~30 mins before I interrupted this hopless process. Therefore I slightly modified the test: we'll compile only 49k lines of code. # Generator ```lua @@ -11,7 +18,7 @@ print "import \"fmt\"" print "func main() {" for i = 0, 49000, 1 do print "fmt.Println(\"hello world\")" end @@ -40,11 +47,26 @@ user 0m0.000s sys 0m0.015s ``` One second warmup. Good. Now let's fix the source and compile. ``` time "C:\Program Files\Go\bin\go.exe" build hello-world-2.go real 0m0.441s user 0m0.015s sys 0m0.000s ``` And this is the results for V compiler: ``` time "C:\opt\v_windows\v\v.exe" hello-world-3.v real 0m1.497s user 0m0.000s sys 0m0.015s ``` # Conclusion V is 3 times slower than Go. But Go is a production-ready compiler, written by the whole world, including paid full-time Google developers. I think, V results are pretty impressive here. -
olegchir renamed this gist
Dec 4, 2021 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -43,4 +43,8 @@ sys 0m0.015s One second warmup. Good. Now let's compile. Well... it's running almost 5 minutes and still did not finished. Also, Golang consumed almost 25 Gb memory on my Windows box, it's half of my available RAM. # Conclusion 2 seconds for V (if it is really true) is a pretty impressive result. It is not slow at all. -
olegchir created this gist
Dec 4, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ # Purpose I want to check claims that V is very slow, by comparing it with Golang: <https://christine.website/blog/v-vaporware-2019-06-23> # Generator ```lua print "package main" print "import \"fmt\"" print "func main() {" for i = 0, 1200000, 1 do print "fmt.Println(\"hello world\")" end print "}" ``` # Generating source files ``` olegchir@OVERWATCH MINGW64 /c/temp $ "C:\opt\lua-5.4.2_Win64_bin\lua54.exe" -v ./gen.lua > hello-world.go ``` # Measuring results First of all, run Golang on a file with an error to find the startup/warmup time ``` olegchir@OVERWATCH MINGW64 /c/temp $ time "C:\Program Files\Go\bin\go.exe" build hello-world.go hello-world.go:1:1: expected 'package', found Lua real 0m1.075s user 0m0.000s sys 0m0.015s ``` One second warmup. Good. Now let's compile. Well... it's running almost 5 minutes and still did not finished. Also, Golang consumed almost 25 Gb memory on my Windows box, it's half of my available RAM.