Re: [GTKMM] ThreadPool scalability



On Sun, 8 Jun 2008, Germán Diago wrote:

I'm using this code to make thumbnails of images. When I execute the
code with 1 thread it runs in 7.6 seconds more or less.
If the code is run with 2 threads, the code runs in 7.1 seconds. But
the code should be roughly twice as fast. Anyone can help here,
please?
The program is attached. When I monitor with gnome-system-monitor, in
the case of 1 thread, it gets 100% cpu for one core (Core 2 duo e 6400
cpu).
But If I use 2 threads, they don't get 100% cpu at any time. Is there
a way to change priority of thread pools? Thank you very much. The
code is attached.

My guess (based on a cursoray glance at the code) is that the lock around Gtk::Image img(...) is the culpret.

This is going to serialise loading the images. Guessing that these images are large (or they wouldn't need thumbnails) and compressed (because most images are), then quite a lot of processor time is going to be needed just to get them off the disk. The fact that you are paralellising the thumbnail creation and *not* parallelising the image loading/decompression is (I'm guessing) the root cause of the poor performance scaling.

This is outside my experience but is there any particular reason why Gtk::Image can't be used from two threads at once?


Charlie - Metropolis Data Consultants - 07976 028167 - 01223 763758


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]