Sprite vs Transition performance

Hi,

I want to optimize my app and I wonder which on below give better performance.

local function loadStar() local obj = display.newImageRect("images/star.png", 13, 13) function onStarOn(o) transition.scaleTo(o, {time=800, xScale = 1.5 , yScale = 1.5, onComplete=onStarOff}) end function onStarOff(o) transition.scaleTo(o, {time=800, xScale = 0.5 , yScale = 0.5, onComplete=onStarOn}) end transition.scaleTo(obj, {time = 1000, xScale = 1.5, yScale = 1.5, onComplete=onStarOff}) end loadStar()

vs

local options = { width = 32, height = 32, numFrames =8 } local sheet = graphics.newImageSheet("star.png", options) local sequenceData = { name = "img", start = 1, count = 8, } local img = display.newSprite(sheet, sequenceData) img.x = 200 img.y =200 img:play()

So Lin

  1. What is  your criteria for more or less performant?

  2. This is a apples and oranges comparison.

  3. The only way to know for certain is to test it in a meaningful way.

  4.  That said, my interpretation of your question and best guess based on experience says a sprite will always be more efficient in terms of CPU time, and memory usage (for large numbers of a single  re-used sprite vs large numbers of a single image using transitions to animate and scale.)

  5.  I think is kind-of a moot point.  Just make it.  Then if you find you have a performance problem, identify it and fix it.

  1. What is  your criteria for more or less performant?

  2. This is a apples and oranges comparison.

  3. The only way to know for certain is to test it in a meaningful way.

  4.  That said, my interpretation of your question and best guess based on experience says a sprite will always be more efficient in terms of CPU time, and memory usage (for large numbers of a single  re-used sprite vs large numbers of a single image using transitions to animate and scale.)

  5.  I think is kind-of a moot point.  Just make it.  Then if you find you have a performance problem, identify it and fix it.