Re: Importing/parsing CSV files
Re: Importing/parsing CSV files
- Subject: Re: Importing/parsing CSV files
- From: Philip Aker <email@hidden>
- Date: Wed, 13 Sep 2006 07:36:00 +0100
On 2006-09-13, at 05:02:07, kai wrote:
The article explains that the speed of access to items in a
particularly long list can be substantially improved by using a
reference to that list - rather than by referring directly to the
list itself. The precise reasons for the performance
characteristics of references in this context are not generally
known. It may have something to do with the short-circuiting of
certain checks that AppleScript normally makes for circular
references - and possibly with the way in which a list is accessed
internally.
It's because scripts are given individual data locations in the
component and kept available until they are disposed of by the parent
or the parent itself is disposed of.
IOW, if you continuously pass a list to a command, then all it's data
has to pass through each interaction between the app and the
component. If you pass a reference, then only a pointer to the list's
data is passed and the messaging is passing individual list member
values or location descriptor objects -- generally a much smaller
amount of data. But if you pass a list in a script, then the script
(and all its data) is passed over once to start with, the component
deals with the list member values directly (there is no back and
forth messaging between the component and the app for list values),
and then hands the desired result value back when the particular
command returns.
It was evidently Serge Belleudy-d'Espinose who discovered that
using a script object's properties to reference a list was not only
more efficient than direct access, but also faster than using "a
reference to". (Global variables or script properties could also be
used for similar referencing, e.g: "item n of *my* scriptProperty".)
FWIW, I believe it's commonly known as the Serge Technique.
Cheers,
Philip Aker
email@hidden
_______________________________________________
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