Jump to content
GreenSock

Jeremy Rudd

Why is masterList cached in a local var?

Recommended Posts

Hi all,

 

This is more of a technical question, but anyways. I noticed that the "masterList" Dictionary object is cached in a local var before iterating through it. Why is this? Is there any speed benefit?

 


var ml:Dictionary = masterList;
var tgt:Object;
for (tgt in ml) {

 

I was just curious if this was needed.

 

Thanks.

Link to comment
Share on other sites

Yep, local variables are accessed faster.

Link to comment
Share on other sites

Strange. I never knew local object vars are accessed faster. You must have near-infinite energy Jack! Half the project owners I know would have stopped answering my questions at this point!

 

Thanks a lot!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×