> Subject: RE: [Interest] [External]Re: How to get QtConcurrent to do what I
> want?
> 
> Something seems off.
> 
> But without looking at the actual code that is allocation 60k tiles and the
> constructor itself, it just seems like a very expensive construction if the
> "new" + "moving a pointer" is taking 3ms each.

I finally figured that part out. 

Since this is just test code and doesn't do any real work yet, I was putting a 
delays in 
tile::load() and tile::remap() just to simulate that those functions take time 
to execute. 
To create a little realism, I was randomizing the amount of that delay instead 
of using a 
fixed delay. To accomplish that, I mistakenly added a QRandomGenerator as a 
member 
variable of the tile class, instead of just calling 
QRandomGenerator::global()->bounded(min, max)
in the tile::load() and tile::remap()functions. Each tile certainly doesn't 
need its own 
uniquely seed random number sequence...

I just made that switch - removed the QRandomGenerator member variable 
>From the tile class, and calling QRandomGenerator::global()->bounded(min, 
>max). Now 
creating  + assigning each tile plummeted from 18 seconds to 15 milliseconds.

That seems pretty acceptable to me...

Sean

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to