Mailing List
Home
Forum Home
Flash Pro
Subjects
Subject: RE: Firework Effect
Web Service Results
Flash Interface with 10mb xml file
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash MX 2004 Sucks
Reading and displaying RSS feeds in Flash MX
Flash and QuickTime VR
Textfield prototype question
XML to Object help
Order of events per frame
MX2004 Dataset itemClassName
memory management removeMovieClip /
Event Dispatcher between classes
Help: MX 2004 How to script a print button to print the entire sli
ScrollPane component doesn 't auto update
setInterval bug identified and fixed
setInterval bug identified and fixed
Listener Object 's best practice
 
RE: AS 2.0 optimising..

RE: AS 2.0 optimising..

2004-03-16       - By ryanm

 Back
Reply:     1     2     3     4     5     6     7     8  

> In the last example the lookup of a word is very fast, because u dont need
> to loop.
>
> What im trying to say is that the difference in speed depends on the
usage.
>
   Right, but in an individual lookup, using a numeric index is faster and
uses less memory than a string. If you *have* to loop through a bunch of
items, then an array will be faster. If you can avoid the loop by going
directly to the object you need by name, then an array obviously isn't a
good choice. That choice is easy, the place where this becomes important is
in the difference between these:

for(var i=0;i<limit;i++){
   doSomething(object["sub"+i]);
}

   or

for(var i=0;i<limit;i++){
   doSomething(object[i]);
}

   The second should execute faster, the amount varying directly with the
size of the integer "limit".

ryanm


=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:107070
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)