Re: definition list recommendations?
Re: definition list recommendations?
- Subject: Re: definition list recommendations?
- From: Emmanuel <email@hidden>
- Date: Thu, 27 Jan 2005 20:54:49 +0100
About associative arrays, I wrote that XMLLib is able of storing any
AppleScript quantity into associative arrays, and that it is very
fast. Has wrote (very roughly summarized) that his libraries for
associative arrays can store any AppleScript quantity, unlike XMLLib,
and that they are very fast, unlike XMLLib.
Both of us are right, and this post is to explain why - it's very
simple actually.
XMLLib stores the data that you submit to it into a persistent
structure, that you can save to disk (as a XML file), and that you
can use in your script. You can count on the data, whatever your
script may be doing with them later.
Has' libraries store references to the data, so that in your script
you can refer to your data (and in particular, retrieve them) in an
efficient and fast fashion.
So, yes, XMLLib stores any kind of AppleScript quantity: numbers,
file specifications, even script objects. And, yes, Has' libraries
store more objects: they can store references belonging to
applications, which make sense in a script but which would be a dead
horse once stored on disk (application references have a contextual
meaning, Finder's window 1 today will not be an interesting concept
tomorrow.)
Yes, XMLLib is fast, in particular it's O(1) (the time for storing or
retrieving an item does not depend on the size of the array, nor on
the rank of the item), basically each operation is 0.2 ms for my 900
Mhz G3.
And, yes, Has' libraries may be faster: when instructed to store a
large object, XMLLib copies the whole data into its own structure,
while Has' libraries will only handle the reference to it. Has'
libraries are O(log n) for retrieving (0.4 ms for n=5000, I think),
and not very fast at storing.
Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden