Re: Unique Items in a text file
Re: Unique Items in a text file
- Subject: Re: Unique Items in a text file
- From: has <email@hidden>
- Date: Tue, 9 Apr 2002 17:37:29 +0100
Emmanuel wrote:
>
Serge Belleudy-d'Espinose has noticed that the access to lists is
>
dramatically accelerated by making the list into a property of an object
>
script. Something like:
>
>
Implementing this trick speeds up the "sort" routine much (I think that the
>
access times turn from O(N2) or O(N3) to O(N.LogN)).
I'd guess from O(n^2.log n) to O(n.log n). From what I was able to follow
of that recent discussion, list accesses are normally O(n) due to a bunch
of extra checking that's performed by AppleScript, for better or worse.
This checking, in turn, seems to be circumvented when you use the
'my'/'its' keywords or references to refer to the list, giving you the sort
of O(1) [constant] access times you'd expect from a vector list.
Curiously, the AS1.1 docs that Shane posted the other day didn't seem to
make any mention of AS's vector lists' O(n) behaviour. Does this imply that
AS1.0's linked lists gave even worse <gulp> O(n^2) behaviour, I wonder? (A
scary thought...)
Algorithms... <aoww-ow-ow> ("Just when you thought it was safe to forget
high school math...")
Cheers,
has
p.s. For a Quicksort with Bells on, Serge's own qSort library is available
on AppleMods at <www.macscripter.net>.
--
http://www.barple.connectfree.co.uk/ -- The Little Page of Beta AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.