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 EECOLOR

 Back
Reply:     1     2     3     4     5     6     7     8  

Array-like collections and Object-like collections cannot be compared in a
way of speed. U can not generally say that an array is faster than an
object. It depends on the use.

For example:

When u biold a dictionary wich translates Dutch to enlish u can do the
folowing:

var word = new Array();
word[0] = new Object();
word[0].dutch = "trein";
word[0].english = "train";

or

var du_word = new Array();
du_word[0] = "trein";

var en_word = new Array();
en_word[0] = "train";

or

var en_du_word = new Object();
en_du_word["train"] = "trein";

var du_en_word = new Object();
en_du_word["trein"] = "train";


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.


Greetz Erik



At 03:30 16-3-2004, you wrote:
> > So -correct me if I'm wrong-, we have no strongly typed arrays,
> > yet. Array lookup should take 0(n) time, not a constant time.
> > I am guessing that they are using a dictionary internally, a
> > hashtable where values are indexed as strings [String name,
> > Object value].
> >
>     I believe you are correct, except that arrays should always be indexed
>by an integer, which should be *slightly* faster than using strings like the
>object collection does. Not because it is strongly typed (because it isn't),
>but simply because an integer index is just smaller and faster than a string
>index.
>
>     So, to state it another way, an array may compile to the same bytecode
>as an object collection, but since it uses an integer as an index it should
>be at least a tiny bit faster than a string indexed object collection.
>
>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:107069
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)