• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: definition list recommendations?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: definition list recommendations?
      • From: Bruce Robertson <email@hidden>
References: 
 >Re: definition list recommendations? (From: has <email@hidden>)

  • Prev by Date: Re: download file with curl and then launch it
  • Next by Date: Re: Terminal grep from AS
  • Previous by thread: Re: definition list recommendations?
  • Next by thread: Re: definition list recommendations?
  • Index(es):
    • Date
    • Thread