Re: How to parse CSV
Re: How to parse CSV
- Subject: Re: How to parse CSV
- From: "Gary (Lists)" <email@hidden>
- Date: Thu, 24 Jan 2008 14:17:17 -0500
- Thread-topic: How to parse CSV
"Skeeve" wrote:
> Neil Faiman wrote:
>> There's a known bug, dating back into the darkest pre-history of
>> AppleScript, that when you append to a list this way, AppleScript ends
>> up copying the list anyway, so what looks like an O(N) loop is
>> actually O(N^2). The standard hack for working around it and getting
>> the expected O(N) performance is to make the list a property of the
>> script rather than a local variable of the handler:
>
> Guess what! It makes the script even worse! Seconds elapsed: 5238!
Neil's right. Search the archives for "serge method" or "nigel/serge" or
"serge object" or just "serge".
There's plenty of on-list code demonstrating that method and its speed
improvements. It's a little more than just making it a property of the
script.
In fact, in September 2006, in a thread with very much the same subject
("Importing/parsing CSV"), there is discussion of the same methods (CSV
parsing requires, often, big lists.)
That thread starts here:
<http://lists.apple.com/archives/applescript-users/2006/Sep/msg00032.html>
Then touches on this exact same suggestion (script list objects) here:
<http://lists.apple.com/archives/applescript-users/2006/Sep/msg00104.html>
But is most useful on that point starting with a post from Kai, here:
<http://lists.apple.com/archives/applescript-users/2006/Sep/msg00118.html>
Kai publishes a parser at that post, which is well worth saving.
(Nigel and Serge, and particularly Nigel (even by Serge), are often
commented on for speed optimization in AS. However, Kai should always be
included in that group, I think. When Nigel and Kai get to wailing on some
code, it always ends up looking like alphabet soup and running blue blazes.)
HTH
--
Gary
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden