[Interest] [External]Re: How to get QtConcurrent to do what I want?
Konstantin Shegunov
kshegunov at gmail.com
Tue Feb 1 14:28:42 CET 2022
On Mon, Jan 31, 2022 at 7:15 PM Murphy, Sean <Sean.Murphy at centauricorp.com>
wrote:
> 1. Creating 60,000 QObjects in a single thread appears to be slow
[...]
>
Ehm, maybe I'm not understanding something, but why do you need objects to
begin with?
> The actual loop is this:
> // generate each tile with its assignment
> [snip]
>
What's the significance of the tiles? As far as I can tell from your
requirements, you don't care about
the "true geometry" of the data.
At least to me it seems you want something like (pseudo algorithm):
1) Start QThread::idealThreadCount threads (QThread::create<> / std::thread)
2) Each thread works on "total samples" / QThread::idealThreadCount buffers
that are completely independent.
2.1) Each thread goes through each sample from a partially mapped (from the
file) buffer, takes the min/max to get the dynamic range
2.2) Sync the threads to get the global min/max
2.3) Go through each of the buffers a second time to normalize the dynamic
range (again no tiles involved, just samples)
3) Done.
Note: As each thread works on its own piece of data in both cases there's
no sync required at any one point - you just read/write different parts of
the same thing. Which is true both for when you load/write from/to a file
and from/to memory.
What am I missing here?
Kind regards,
Konstantin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220201/1b6d94db/attachment.htm>
More information about the Interest
mailing list