Hello Chilton

It's not really the interpolator that's causing the CPU usage - it's the whole composition.

What's happening is that the interpolator is driving the animation, so while that's working, the CPU has to also calculate the line positions, handle rendering etc. When you remove the interpolator (or disconnect it), no animation happens, and QC doesn't do anything at all (hence CPU usage falls to near zero - it's waiting for something to do).

The reason why the duration has no effect on CPU time is simple - you're asking it to interpolate between two values over a certain duration. It still has to calculate the current position every frame though, so it's going to use the same CPU time each frame. It makes no difference if the animation moves slow or fast on screen, the computer still has to draw a picture 60 times a second to make it look smooth. To reduce CPU usage, you need to change the frame rate (it's normally set to 60, but you can change it in the prefs). Less frame rate = less work to do, but it won't look good in most cases.

Really though, 8.5% CPU usage isn't a lot. You shouldn't worry about it unless you're writing something where performance is really critical, or it's hitting 100% and running slowly.

Chris


On 3 Sep 2009, at 01:18, Chilton Webb wrote:

Hi!

Here's the thing--I've noticed that some of the simplest animations in QC seem to suck up an enormous amount of CPU time, for what little they appear to do. If this was my own code, I'd know how to fix it. But with things like the interpolator, I'm not entirely clear how I should even start to fix things like this. Any suggestions would be greatly appreciated!

So I did some experimenting. What this video shows are the areas I'm most concerned with...
http://www.conjurebunny.com/QuartzCompositionCPUUsage.mov

I have a simple composition that draws some lines, and uses a single interpolator to move the lines around.

At the start, I have 8.5% of my CPU time taken up by the interpolator. It's set to have a duration of '2'. Which yields a really, really fast animation.

When I remove the connection to the interpolator, the CPU time drops to 0.3 % or so. Which is expected. No mysteries there!

Next I wire it back up, and bump the duration to an incredibly high number. Now I have the same CPU % usage that I had before! That's the first thing that doesn't make sense. I would have expected it to at least use less CPU time, as the duration increases.

Does this mean that the QC runs on some internal timer that runs at a fixed rate? If so, can I alter the speed of the internal timer?

Marching on...

Next I wire up the interpolator to three other sets of lines. The CPU time jumps up to a much higher number. Remember though, the interpolator is still set to a really high number.

After this is done, the CPU time sticks around 25%.

And I can kinda understand it up to this point, assuming there's some internal timer that is used that is independent of everything else. But...

The last thing I do is set the interpolator back to '2'.

The CPU time drops back down to around 1% faster than it was at the very beginning (around 8.7 - 9.5 % CPU time), when it only had one set of lines to draw.

That makes no sense to me. Why would it use MORE CPU time if it's generating less, and less time when it is generating more?

Any suggestions greatly appreciated!

Thank you!
-Chilton
ConjureBunny.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected] )
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/psonice%40gmail.com

This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to