Ticket #1872 (closed: fixed)

Opened 10 years ago

Last modified 5 years ago

3D Instrument View: improve startup performance for large instruments.

Reported by: Janik Zikovsky Owned by: Janik Zikovsky
Priority: major Milestone: Iteration 26
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Michael Whitty

Description

It takes a couple of seconds event on a fast computer to build up the color list for all pixels on e.g. TOPAZ. Perhaps parallelization is the way to make it faster, or maybe re-work the way colors get passed down.

Change History

comment:1 Changed 10 years ago by Janik Zikovsky

  • Status changed from new to accepted

As an add-on, consider how integrating the colors takes time...

comment:2 Changed 10 years ago by Janik Zikovsky

  • Summary changed from 3D Instrument View: would it be possible to build textures for RectangularDetector's in parallel? to 3D Instrument View: improve startup performance for large instruments.

Here is the timing for the WISH instrument (WISH00016748 file) before any changes:

Instrument3DWidget::ParseInstrumentGeometry() took 0.294798 seconds Instrument3DWidget::calculateBinRange() took 19.0522 seconds Instrument3DWidget::calculateColorCounts(): mInstrumentActor->getDetectorIDList() took 0.277472 seconds Instrument3DWidget::createWorkspaceIndexList() took 0.744245 seconds Instrument3DWidget::calculateColorCounts():Integrating workspace took 39.0107 seconds

1281 GL 1d error1

Instrument3DWidget::calculateColorCounts(): mInstrumentActor->setDetectorColors() took 0.034032 seconds Instrument3DWidget::calculateColorCounts() took 40.2688 seconds Instrument3DWidget::setWorkspace() took 59.6285 seconds

It can be seen that getting the bin range and calculating the color counts are, by far, the slowest operations and are the first spots to optimize.

comment:3 Changed 10 years ago by Janik Zikovsky

Timing for SNAP_4105:

Instrument3DWidget::ParseInstrumentGeometry() took 0.011403 seconds Instrument3DWidget::calculateBinRange() took 0.101935 seconds Instrument3DWidget::calculateColorCounts(): mInstrumentActor->getDetectorIDList() took 0.29363 seconds

Instrument3DWidget::createWorkspaceIndexList() took 3.34379 seconds Instrument3DWidget::calculateColorCounts():Integrating workspace took 4.74109 seconds Instrument3DWidget::calculateColorCounts(): mInstrumentActor->setDetectorColors() took 0.051766 seconds

Instrument3DWidget::calculateColorCounts() took 11.0607 seconds Instrument3DWidget::setWorkspace() took 11.2118 seconds

comment:4 Changed 10 years ago by Janik Zikovsky

(In [7625]) Refs #1872: Added an option to use the 'entire range' in X in the instrument view by default. This saves about 20 seconds when opening the WISH instrument view: 59 seconds is down to 40 seconds opening time.

comment:5 Changed 10 years ago by Janik Zikovsky

(In [7626]) Refs #1872: Had left on some timing output.

comment:6 Changed 10 years ago by Janik Zikovsky

My upcoming check in timing results, for the part of the calculation to integrate the counts (the slowest part):

File SNAP_4111, EventWorkspace.

As a pseudo-workspace 2D, binned to 1600 bins: Non parallelized: 47 seconds after sorting event list.

As a pseudo-workspace 2D, binned to 16000 bins: Non parallelized: 401 seconds after sorting event list.

As an event workspace: Non-parallelized: 30 seconds. Parallelized, first run: 5.5 seconds. Parallelized, second run: 0.3 seconds.

So the speed improvement is easily x100 times, up to x1000 times for very finely binned workspaces!

comment:7 Changed 10 years ago by Janik Zikovsky

(formatting fix)

My upcoming check in timing results, for the part of the calculation to integrate the counts (the slowest part):

File SNAP_4111, EventWorkspace.

As a pseudo-workspace 2D, binned to 1600 bins:

  • Non parallelized: 47 seconds after sorting event list.

As a pseudo-workspace 2D, binned to 16000 bins:

  • Non parallelized: 401 seconds after sorting event list.

As an event workspace:

  • Non-parallelized: 30 seconds.
  • Parallelized, first run: 5.5 seconds.
  • Parallelized, second run: 0.3 seconds.

So the speed improvement is easily x100 times, up to x1000 times for very finely binned workspaces!

comment:8 Changed 10 years ago by Janik Zikovsky

(In [7654]) Refs #1872: 100x to 1000x faster integration of counts for the purposes of instrument display. Is done in parallel and can take advantage of EventList properties to make it faster.

comment:9 Changed 10 years ago by Janik Zikovsky

Next up:

Instrument3DWidget::calculateColorCounts(): mInstrumentActor->getDetectorIDList() took 2.7619 seconds

and

Instrument3DWidget::createWorkspaceIndexList() took 3.47304 seconds

... these two are the slowest steps now.

comment:10 Changed 10 years ago by Janik Zikovsky

(In [7655]) Refs #1872: the integration code does not sort by TOF if it doesn't need to = 0.08 seconds instead of 30! Also, removing timing output.

comment:11 Changed 10 years ago by Janik Zikovsky

(In [7692]) Refs #1872: The workspace index list is now cached in the 3D instrument widget, saving ~ 3 seconds per call. Pick detector now is a hundred times more responsive on large instruments.

comment:12 Changed 10 years ago by Janik Zikovsky

  • Status changed from accepted to verify
  • Resolution set to fixed

(In [7693]) Fixes #1872: performance is much better.

comment:13 Changed 10 years ago by Michael Whitty

  • Status changed from verify to verifying
  • Tester set to Michael Whitty

comment:14 Changed 10 years ago by Michael Whitty

  • Status changed from verifying to closed

indeed, performance is much improved. Testing with TOPAZ, pick completely fails pre these changes, and works well in recent builds.

comment:15 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 2719

Note: See TracTickets for help on using tickets.