-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Optimize GDScript VM codegen for MSVC #81200
Conversation
That reminds me, could we use |
dbe8a84
to
00c9b70
Compare
If you mean using them for dispatching opcodes, there's the computed gotos optimization already in place for them, for which there's no point in mixing with ( |
Would be interesting to check how this affects build time for this file, both with and without exceptions enabled (see #80513). |
00c9b70
to
9c15e2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Would like to have some numbers so we know exactly what we gain, but it's not blocking.
Thanks! |
For posterity, I did run some benchmarks on this. The MSVC build is much faster with this patch but still noticeably slower than the GCC/MinGW version using the synthetic test in #11518 adapted to 4.x ( test.zip ). Here are the hyperfine results for 549fcce (+ patch) built with $ hyperfine.exe -w 1 -r 5 .\test\msvc_base\test.exe .\test\msvc_opt\test.exe .\test\mingw\test.exe
Benchmark 1: .\test\msvc_base\test.exe
Time (mean ± σ): 22.410 s ± 0.312 s [User: 22.251 s, System: 0.040 s]
Range (min … max): 22.075 s … 22.911 s 5 runs
Benchmark 2: .\test\msvc_opt\test.exe
Time (mean ± σ): 16.885 s ± 0.078 s [User: 16.701 s, System: 0.052 s]
Range (min … max): 16.774 s … 16.960 s 5 runs
Benchmark 3: .\test\mingw\test.exe
Time (mean ± σ): 15.021 s ± 0.103 s [User: 14.892 s, System: 0.021 s]
Range (min … max): 14.915 s … 15.194 s 5 runs
Summary
.\test\mingw\test.exe ran
1.12 ± 0.01 times faster than .\test\msvc_opt\test.exe
1.49 ± 0.02 times faster than .\test\msvc_base\test.exe |
This allegedly leads to less optimal code than in the case of GCC/Clang's computed gotos, but is an improvement for those building with MSVC. I haven't benchmarked myself, so TIWAGOS.