Results 1 to 4 of 4

Thread: Qt + OS X 10.9 = threading issues?

  1. #1
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default 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.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt + OS X 10.9 = threading issues?

    Hard to tell, but since you experience a slow down on the first run that does not appear in subsequent run it looks a lot like something related to the JIT and/or disk buffers.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt + OS X 10.9 = threading issues?

    Thanks for your reply, anda_skoa. I agree that it's not an easy one to pinpoint, but I should probably have mentioned that no disk accesses are performed during the simulation. So, disk buffering is not an 'option' here. On the other hand, the JIT might be a route worth investigating even though this wouldn't explain (to me, at least) why if I run simulation S1 then it's 'slow', but then if I run simulation S2 then it's 'fast'. Indeed, before running the simulation I will generate the JIT code. Also, it's not only the simulation (and therefore JIT code) that is slow, it's the whole simulation thread. In other words, anything I do within that simulation thread is slow the first time round.

  4. #4
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt + OS X 10.9 = threading issues?

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

Similar Threads

  1. Multi-threading
    By plopes21 in forum Qt Programming
    Replies: 6
    Last Post: 2nd January 2013, 17:45
  2. Threading with rsh and rcp
    By jaxrpc in forum Newbie
    Replies: 2
    Last Post: 4th June 2010, 11:50
  3. Threading...?
    By sekatsim in forum Qt Programming
    Replies: 12
    Last Post: 10th June 2008, 01:14
  4. Qt Threading
    By avh in forum Newbie
    Replies: 7
    Last Post: 30th May 2008, 20:20
  5. Sub-Threading
    By TheGrimace in forum Qt Programming
    Replies: 4
    Last Post: 7th June 2007, 16:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.