Re: possible bug? Radically different time profile for list access in script objects or by explicit reference.
Re: possible bug? Radically different time profile for list access in script objects or by explicit reference.
- Subject: Re: possible bug? Radically different time profile for list access in script objects or by explicit reference.
- From: email@hidden (Michael Sullivan)
- Date: Mon, 11 Mar 2002 13:09:05 -0500
- Organization: Society for the Incurably Pompous
has writes:
>
Anyway; Chris, while I appreciate what you're saying about deep changes not
>
being simple to make or something to be rushed into, perhaps I could quote
>
something Paul Skinner wrote to the macscrpt list:
>
[...]
>
So, just to clarify, On my PG G3 400 OS 10.1.3/AS 1.8.1...
>
>
Looping through a 50000 item list takes 42 minutes.
>
Looping through a reference to a 50000 item list takes 7 seconds.
>
Looping through a reference to "MY" 50000 item list takes 8 seconds.
>
Looping through a script object's 50000 item list takes 2 seconds.
>
Looping through "MY" 50000 item list takes 2 seconds.
>
[...]
>
Which suggests a few things to me:
First he already saw that, because I quoted it, or at least enough of it
for him to see the n^2 v. n behavior, and I'm sure he's well aware of
how brutal that gets on very long lists. On short lists, it's actually
not a huge problem.
>
1. the checking you describe is inconsistently enforced to begin with.
>
[Perhaps AS itself concurs with your own feeling that it's unnecessary?]
Not necessarily. If it's not the kind of simple overlooked temporary
that I proposed, the situation could be much more complicated than
simply that using references disables the checking. Maybe using
references, or objects makes it impossible to have the kind of
circularity checked against, or makes it much easier (take less time) to
check.
The real question is: How often does this check find something
important and what is the benefit when it does?
In any case, without having the the actual code (which presumably is not
open source) available to look at, it's almost impossible to say whether
such a change is trivial, so we don't have much choice but to accept the
word of the person who *has* seen it that it probably isn't.
Chris's contributions on the list lead me to think he's a better judge
of this sort of thing than I am, I figure our only responsibilitty is
make sure he's aware of the behaviour and that many of us find it to be
a pain.
>
2. it would seem that users have survived its partial omission this far
>
without serious effects [though it's possible this is due entirely to
>
luck/author-skills in not stepping on any landmines]
>
2. as the various hacks described on the macscrpt list are more widely
>
disseminated, folk are going to work round this checking process anyway.
>
Even if it does mean uglier code and possible security issues [which they
>
may not even realise], the benefits are too great to ignore.
Bear in mind that the fact that these hacks exist lessens the need to
fix the problem. If you really care about speed and are working with
long lists, there are documented ways to do that. I didn't even realize
this was in the language guide until Arthu mentioned it, but there it
is.
>
3. that two seconds versus 42 minutes sounds like a _damn_ good reason for
>
doing some kind of 'bug fix', even if it isn't strictly a bug as such.
You've got to look at how often you're dealing with 50000 item lists in
Applescript. I realize it's not all that uncommon, but it's not as if
you'll see that kind of difference on *every* list. Under 100 or so
items the difference is probably not even noticeable unless it's in a
long repeat.
Michael
--
Michael Sullivan
Business Card Express of CT Thermographers to the Trade
Cheshire, CT email@hidden
_______________________________________________
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.