Important: Please read the Qt Code of Conduct -

[SOLVED] Qt + OS X 10.9 = threading issues?

  • Hi,

    I am developing an application that can be used to run mathematical simulations. Each simulation is run in its own thread. Every works fine and everything, except that I recently noticed that if I have two simulations S1 and S2, then if I first run S1 then it will run ‘slowly’. From there, if I rerun S1 or run S2, then S1 or S2 will run ‘fast’. In other words, no matter which simulation I run the first time, it will run ‘slowly’ while any subsequent simulation will run fast. Just to give you an idea, the first time I run a particular simulation, it takes ~28.9 s to run while subsequent runs of that same simulation take ~12.7 s (!!).

    In an attempt to pinpoint what might be causing this, I tried my application on Windows and Linux, and I didn’t experience that behaviour. From there, I thought I would try my application on older versions of OS X (I tried Mac OS X 10.7 and OS X 10.8), and again I didn’t experience that behaviour. Next, I decided to test previous versions of my application and they all experienced the same behaviour on OS X 10.9, but not on Mac OS X 10.7 or OS X 10.8.

    So, there is clearly an issue between my application and OS X 10.9. Now, it may be worth pointing out that the different versions of my application were built using different versions of Qt (as well as of LLVM, of which I use its JIT engine to run my simulations). So, could it be that there is something in Qt that is not working ‘properly’ with OS X 10.9 (e.g. threading)? Alternatively, maybe there is something in LLVM that I don’t do and which is ‘required’ to work ‘properly’ in OS X 10.9?

    So, has anyone ever come across something similar and/or would know how to fix this issue?

    Cheers, Alan.

  • Lifetime Qt Champion


    Can you reproduce this with a simple application ?

  • Instruments is what you should use.

  • SGaist: yes, I intend to do that soon.
    sandy.martel: I actually did use Instruments and, though I am no expert when it comes to its use, I did notice that it's the whole thread of the first simulation that is slow (i.e. it's not on the computation itself, but also saving intermediate results in memory, plotting the results, etc.).

  • FWIW, this issue has been resolved by upgrading LLVM from version 3.4.2 to version 3.5.

  • Lifetime Qt Champion

    Nice ! :)

    Happy coding !

Log in to reply