Bug #1603

Updated by pospelov about 4 years ago

*Problem I: cancel job is not working*

How to reproduce:

* start new GUI
* drag and drop sample to sample canvas, use "Interference 2D paracrystal" as a sample which requires a lot of CPU
* in InstrumentView define detector 200x200 channels to make the simulation run even longer
* in SimulationView start simulation
* go to JobView, hover the mouse on running job, press cancel sign
> Simulation should stop immediately, partly simulated image should be shown

*Problem II: GUI performance is two times slower wrt 1.6.1*

There is a huge performance degradation in GUI because of (I think) refactored ProgressHandler.

How to check:
* Create sample in GUI "Cylinders and prisms", set detector 300x300
* Run simulation, check simulation duration (lower left corner of JobView)

* new ProgressHandler - 740msec
* 1.6.2 release - 370msec

Why ProgressHandler?

* I have commented code in ProgressHandler::incrementDone, make it only return true. Results were:
* new ProgressHandler - 340msec
* 1.6.2 release - 350msec

I think that the reason is either the cost of
static std::mutex single_mutex;
std::unique_lock<std::mutex> single_lock( single_mutex );
or (less likely) threads blocking each other on the way to report ProgressHandler every tiny change in progress.

Earlier, progressHandler was splitted on two parts (ProgressHandler itself with mutex, and ProgressHandlerDWBA without mutex). This was done intentionally to avoid aforementioned problem.