Results 1 to 4 of 4

Thread: qt algorithm speed up problem

  1. #1

    Default qt algorithm speed up problem

    Hello,

    I have a problem of parallel 3 different algorithm, I want to use the qthread to run this 3 algorithm at the same time.

    if i run them in sequence, it will cost 12mins 12 mins and 17 mins which is 41 mins totally.

    I tried the QThread to let them run at the same time, the cpu usage shows that they are running at the same time. However, it cost me 2 hours to finish the whole process.

    I am just wondering is there anyway to run 3 different algorithm at the same time, and fast speed.


    thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: qt algorithm speed up problem

    That should not be happening.
    Can you provide a compilable demonstration? (if possible)

  3. #3

    Default Re: qt algorithm speed up problem

    If your algorithms are all accessing/changing the same data then you will not see much of a speedup (you will probably see a significant slowdown as the data needs to be locked while one thread is operating on it - to ensure that the data isn't changed by another thread at the same time). This can cause significant overhead from the thread class. It shouldn't double the runtime, though, unless you are performing only micro-calculations after each data access (i.e. if the overhead of thread locking/unlocking is greater than the actual calculation done in each such interval by your algorithms).

    Thread safety

    As a final note: threads (for speedup) only make sense if you have a multi-core CPU. Otherwise threads are just useful as a method for keeping the GUI from freezing (at the cost of performance of underlying calculations).
    Last edited by antialias; 20th August 2010 at 10:24.

  4. #4

    Default Re: qt algorithm speed up problem

    Quote Originally Posted by tbscope View Post
    That should not be happening.
    Can you provide a compilable demonstration? (if possible)
    you mean the code? I can forward you the svn branch of my code if you like

Similar Threads

  1. qtthread to speed up the algorithm
    By leonardhead in forum Qt Programming
    Replies: 1
    Last Post: 20th August 2010, 05:09
  2. Phonon MediaObject Speed Problem
    By Revengeog in forum Qt Programming
    Replies: 1
    Last Post: 14th October 2009, 07:15
  3. QSqlQueryModel speed problem
    By tbscope in forum Qt Programming
    Replies: 2
    Last Post: 23rd March 2008, 11:31
  4. QTcpSocket speed problem
    By benelgiac in forum Qt Programming
    Replies: 4
    Last Post: 1st May 2007, 13:50
  5. Dijkstra's Algorithm
    By therealjag in forum Qt Programming
    Replies: 2
    Last Post: 6th March 2006, 10:16

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.