Code optimization question

Ok. So lets say i use this

number = 2+6
stuff1 = number
stuff2 = number

Does the number gets calculated 2 times or 1 when called with stuff?

I’ts just an example, I need to draw about 10 traces on every tick and I need to optimize it, so would

trace = util.TraceLine({start...})
pos = trace.HitPos
ent = trace.Entity

be more effective than the following?

pos = util.TraceLine({start...}).HitPos
ent = util.TraceLine({start...}).Entity

Or is it exactly the same?

The one where you define trace would be more optimized because it’s not creating a new trace as in the second one you have two traces.

Only once, when it’s defined.

Former is better.

[editline]31st October 2010[/editline]


Thanks guys.