-
Notifications
You must be signed in to change notification settings - Fork 39
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
Compiling perl-5.37.3 from source is slow with GCC 12.2.0 MSVCRT #114
Comments
I had the impression it wasn't much faster, but hadn't noticed yet it was actually slower. Have you reported this to GCC development? |
I've just tried building gmp-6.2.1 in the MSYS2 shell, and found that the speed disparity between 12.1.0 and 12.2.0 is not as great, but still quite significant.
No. I'll do that tomorrow. |
I just tried building gmp-6.2.1 (static+shared) in my build environment with gcc 12.1.0 and 12.2.0 at the same time on the same system and both build processes ran absolutely parallel and finished about the same time too. So I couldn't really reproduce it. Note that I was using a RAM drive (using ImDisk) both to build on and as TMP location. |
Tried building gmp-6.2.1 (static+shared) again, this time building on local disk (NVMe disk, TMP still pointed to RAM drive).
So it was 20 seconds slower (or between 2% and 3%). Just in case, I will now also try without pointing TMP to my RAM drive.... |
New results, completely using disk GCC 12.2.0 (ucrt) build 1 second faster. |
Final try: build gmp-6.2.1 (static+shared) on RAM disk (TMP also on RAM disk), antivirus disabled:
Timing includes configure and make twice (once static and once shared). So in this case the newer compiler was (slightly) faster. Conclusion: I'm not able to reproduce your complaint. |
Can you share how you build Perl, so I can give that a try too? |
Yes, I find that the UCRT versions of gcc-12.1.0 and gcc-12.2.0 are quite consistent with each other wrt building gmp-6.2.1. AFAIK, perl cannot be built with the UCRT compilers.
The CCHOME argument needs to identify the location of gcc's "bin" folder - which means that it will terminate with "\mingw64", and without a trailing backslash. I think that should be enough to provide a successful running of 'gmake', and to observe the issue. If you're unable to reproduce the issue I'm seeing, then I probably have to start wondering what it is about this Windows 7 system of mine that binds up this MSVCRT gcc-12.2.0 compiler. In the meantime, I'll try the same experiment on a Windows 10 laptop that I have and see if that makes any difference BTW, here's the (rough) timings for the gmp 'make' phase to complete on the Windows 7 machine using the 4 compilers that I've now tried: |
I'm on Windows 11. I just tried building gmp-6.2.1 (static+shared) again (on RAM drive, antivirus disabled) with MSVCRT GCC/MinGW-w64 (64-bit) versions. Timings for only the
So I'm still not seeing the big difference you are seeing. |
On Windows 10, I'm still seeing a difference. It's a much slower system than Windows 7, and gmp's make stage took 11 minutes 40 with gcc-12.1.0 and 13 minutes 10 seconds with gcc-12.2.0. As regards, the 'make' stage of the perl-5.37.3 build on Windows 10, gcc-12.2.0 is taking twice as long as gcc-12.1.0. If you could run that test against perl-5.37.3, that would be helpful. Other than that, I think I'll let this Issue sit for a day or 2 (if that's ok with you) and then close it as a "just me" issue if nothing enlightening has turned up. I only installed gcc-12.2.0 last night. |
On the Windows 7, while running the 'gmake' step of the perl-5.37.3 build, I've subsequently done a comparison of the time taken to process the first 2 files (toke.c and regcomp.c) that are compiled. Compiling toke.c takes 5 seconds with gcc-12.1 and 19 seconds with gcc-12.2. Anyway, as this is a "just me" thing at this stage, I'll close this Issue. |
For the record, I've tested building Perl as well, and in summary I confirm @sisyphus results - 12.2.0 is clearly taking a much longer time than 12.2.1. Basics:
In the builds I have run like this (example for 12.1.0):
I've done this from blead just now as 5.37.3 are missing some important build fixes, although not yet the optimization fix. Whether the optimization stuff is required for gcc 12 I have not yet ascertained. For the specific examples made by @sisyphus I get the following: gcc830: toke.c=4s, regcomp.c=7s, full build 7m36s It's evident that there are clear differences; gcc1210 is just slightly slower than gcc830, but gcc1220 takes a giant leap to something like threefold for the individual files. A very uneducated guess would be that maybe the optimization step(s) are so vastly improved that it does that better, but to a large cost in running time. Well...yeah...probably not, just tossing it out there...:-) |
@kenneth-olwing, thank you for checking and confirming this.
The problems I experience building perl with x64 gcc-12.1 and -O2 are still present with gcc-12.2. (We haven't discussed that in this thread - I think it's probably a separate issue.)
Yes, I had also noticed the same. I've also just timed the compiling of toke.c and regcomp.c with 32-bit versions of gcc-12.1.0 and gcc-12.2.0. Note: I claimed earlier that it was a 4x (or thereabouts) slowdown ... but I now think 3x is closer to the actual mark. Before I report this to gcc (as @brechtsanders suggested earlier), I'll try to find out if linux folk are also seeing the same sort of thing when building perl with gcc-12.1 and gcc-12.2. |
ANother thing to check if it's really gcc slowing down or part of binutils. I noticed that binutils added a bunch of Windows specific code related to opening files. In #112 this actually caused issues as that code is not perfect yet. Those issues were when I suspect the same added code may also have some performance overhead, but I haven't measured it yet. |
I think it's gcc.
and there is no mention in either of those commands of any of the "binutils" commands listed at https://en.wikipedia.org/wiki/GNU_Binutils . But I'm a bit out of my depth, here. Is it possible that binutils commands are involved (but unannounced) in the running of those compilations ? |
If you add |
Not directly relevant here perhaps, but since I stated:
I now have - so FWIW, apparently -O2 doesn't work for 12.2.0 either, I get a couple of test fails for a Perl build unless I shift to -Os (however, the failing tests are different from the ones with 8.3.0) |
I've tried that, and it's a rather weird result. I've manually re-run the compiling of toke.c using the
Instantly, there's quite a few lines of output flash by (including an
Then the cmd.exe cursor just moves to the next line and blinks and blinks and blinks (without any announcement of what is being done) until the compilation completes instantly with some more lines of output (including another Could it be that the output is being buffered ? It's being sent to STDERR, and I have this notion that it's therefore not subject to buffering. Here is the entire output of the command:
Cheers, |
With gcc-12.1.0 (x86_64, msvcrt) building perl-5.37.3 from source took 11 minutes 20 seconds.
With gcc-12.2.0(x86_64, msvcrt) the same task took 23 minutes.
I ran both builds concurrently in 2 separate cmd.exe shells, side by side on my Windows 7 system - same perl source, same build options, same everything except for the winlibs toolchain.
When building perl, it's not all just compilation of C code, but it's the compilations of the various C files that stand out as being about twice as slow.
I certainly didn't need to run the comparison to realize that gcc-12.2.0 was compiling the C code much more slowly.
AFAICS, there's no difference in the final product produced by gcc-12.1.0 and gcc-12.2.0.
Both perl.exe files are 25600 bytes, both perl537.dll files are 3127808 bytes and the performance of both perls is comparable.
I ran the perl test suite for both perls concurrently, and they ran at the same speed.
Thank you, @brechtsanders, for the work you do in providing these builds.
Cheers,
Rob
The text was updated successfully, but these errors were encountered: