What's "fastest": Local variables or 'flags'

Hi, I’m currently in the stage of tweaking my app for best performance, so I was wondering what’s fastest for the device to process: Local variables or flagged local variables?

For example I’ve got an object called Ball.
If Ball is good then I want to print “Hello”.

What’s fastest to do:

local ball = display.newImage("ball.png", 100, 100)  
local ballGood = true  
  
if(ballGood == true) then  
 display.newText("Hi", 200, 100)  
end  

or,

local ball = display.newImage("ball.png", 100, 100)  
ball.isGood = true  
  
if(ball.isGood == true) then  
 display.newText("Hi", 200, 100)  
end  

(This above code is obviously not used in my code, it’s just an illustration)
Thanks in advance, [import]uid: 14018 topic_id: 7400 reply_id: 307400[/import]

not sure, i imagine reading a property from an object which essentially has a number of other properties might be a bit slower. however the benefit is if you pass the ball reference to another file module you can still access it’s property from there.

[import]uid: 6645 topic_id: 7400 reply_id: 26127[/import]

unless you are going to do that check over 100,000 times in a tight loop there is significantly no performance penalty and even then, i would still argue, that the sample you provided is insignificant.

focus on game play, number of objects, collisions, touch events, etc… which can lead to visible p4mance penalties rather than a look up into an objects table or global data

c

[import]uid: 24 topic_id: 7400 reply_id: 26198[/import]

Okay, thanks for the advice:-) [import]uid: 14018 topic_id: 7400 reply_id: 26205[/import]