Page MenuHomePhabricator | MITK

Improve Rendering performance of planar figures
Closed, ResolvedPublic

Description

During a performance profile session of the rendering we discovered some issues when rendering planar figures (many of them actually). One big part of it were unneccessary heap allocations in mitkPlanarFigureMapper2D.cpp.

float* colorVector = new float[4];
colorVector[0]     = color[0];
colorVector[1]     = color[1];
colorVector[2]     = color[2];
colorVector[3]     = opacity;

Should be replaced with:

const float colorVector[] = {color[0], color[1], color[2], opacity};

The same for shadow and helperColorVector.

Sorry for not using the standard patch workflow...

Event Timeline

kast created this task.Fri, Dec 7, 12:08 PM
kislinsk claimed this task.Wed, Dec 12, 3:52 PM
kislinsk added a subscriber: kislinsk.

Thanks for reporting, I'll have a look at this. Do you need the fix to be backported to the 2018.04 release or is a fix in the master branch sufficient?

kislinsk triaged this task as Low priority.Wed, Dec 12, 3:52 PM
kislinsk closed this task as Resolved.Wed, Dec 12, 4:18 PM

Fixed with std::array and also fixed a memory leak.

Oops, turns out, the variables are not even in use...