[Sugar-devel] [Dextrose] [PATCH v5 sugar] Pulsing icon delayed by 5 seconds or so SL#2080

James Cameron quozl at laptop.org
Thu Oct 28 19:56:25 EDT 2010


On Thu, Oct 28, 2010 at 03:44:37PM -0300, Gonzalo Odiard wrote:
> I think the problem is the code is rendering the svg icon every time
> the color is changed.  There are not cache or cairo operation used to
> avoid this.

I agree.  Martin Dengler's stats graph confirms it.

Anurag is proposing skipping the paint after the first rendering.  It
remains a puzzle to me why the first frame rendering takes so much
longer than the remaining frames.

In Netrek when I faced this kind of problem, I solved it by
pre-rendering a reduced number of frames, or at least caching the
rendered frames.

The frame rate is 10 Hz.  The _phase is continually incremented, and the
level is set using:

	self._level = (math.sin(self._phase) + 1) / 2

The first two seconds uses these levels:

0.500000
0.920735
0.954649
0.570560
0.121599
0.020538
0.360292
0.828493
0.994679
0.706059
0.227989
0.000005
0.231714
0.710084
0.995304
0.825144
0.356048
0.019301
0.124506
0.574939

Now if these were filtered to a reduced set of levels, the rendered
images could be cached and re-used.

	N = 10
	self._level = int(math.sin(self._phase) + 1) / 2 * N) / N

However, this moves the problem from CPU cycle cost to memory cost.

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list