are saved transforms quicker than .transform?

this is actually a general question in the sense that if i have a script for movement for example which is obviously a script that will use the transform/rigidbody components of the object there attached to.
is it worthwhile to do

movement_transform = transform;

then later do


or is
transform.forward just as fast?

it seems like finding the attached component MIGHT be an intensive process for unity (it seems a bit odd if so, i’d have imagine it’d almost just be a saved memory address, in which case it would be only VERY VERY slightly faster to go straight to it than grab the memory address first).

The thing is when i used a for loop to get something it appeared saving it and accessing it was ALOT faster than the alternative.

Based on that i’m actually fairly sure it is faster but if you know i’d also like to know why. Is retrieving the memory address really that intensive?

Yes it is. I did a quick performance test sometime last year just by accessing the transform ~1000 times and comparing times. Storing the transform is considerably faster but i’d only bother if you’re accessing the transform every update or if there’s a lot of instances of that object.

Transform is just one of many co-equal components of the gameObject, stored in a list.

So cow.transform finds the component list, initializes the search pointer and begins the loop. Then finds the 1st in the list (does a TypeOf on it?) and checks whether it’s a Transform.