StephanTLavavej / mingw-distro

MinGW distro build scripts.
494 stars 55 forks source link

Rare, mysterious reports of slow generated executables #30

Closed StephanTLavavej closed 7 years ago

StephanTLavavej commented 7 years ago

I've never observed this, and my distro has thousands of happy users, but I've received a couple of reports (here and here) where generated executables are slow, with no known cause yet:

I found that his version produced binaries that are incredibly slow for unknown reasons. [...] Msys2 and mingw-w64 are okay.

I found the exact same thing. Unfortunately, this was about a year ago, so I don't remember if I found anything through Very Sleepy. I remember being stumped, though. Nothing obvious why it was much, much slower. (my app is a CPU bound HW simulation, so no weird IO behavior or anything like that).

Questions:

  1. Can we get a minimal repro for this?

  2. Is there a codegen difference between my distro and others?

  3. Given an Affected Machine (like raevnos and voxmea have) and an Unaffected Machine (like mine), what happens if binaries compiled on Affected are executed on Unaffected and vice versa?

  4. Is there any commonality among Affected Machines? Like, weird CPUs or OSes?

My current wild guess is that my use of -O3 is generating some instruction sequence that particular, uncommon processors really hate. (I run Haswell Refresh.)

voxmea commented 7 years ago

I no longer see this behavior with version 14.1. I didn't see a way to download old versions of your distro (I was guessing I would've been using version 13.1 or so), so not sure if it was user error, or an issue with an older compiler, or an issue with a previous version of my code base.

I've been trying to think more about what might have been odd about my program, and the only thing I can think of is that we frequently allocated some large objects on the stack (we'd see chkstk at the top of our profile, we've since gotten rid of that code).

Thanks for opening this. My reddit comment was intended as mere anecdote and that it was interesting to hear someone else had seen something similar, and not a bug report. I wish I could remember more about what I saw in the profile when I was investigating, just in case it would help.

StephanTLavavej commented 7 years ago

The History table at the bottom of my webpage has a download link for the previous version of the distro (this is just in case something goes wrong with a distro update and I need to roll back, although that's never happened). I'm pretty ruthless about purging older versions, since I don't believe in supporting old toolchains.

Good to know that the problem has vanished for you with 14.1.