Page MenuHomePhabricator

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

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?

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

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