Re: Position of an element in a list
Re: Position of an element in a list
- Subject: Re: Position of an element in a list
- From: Jim Underwood <email@hidden>
- Date: Tue, 1 Aug 2017 00:17:58 +0000
- Thread-topic: Position of an element in a list
AppleScript is a strange beast.
For the longest time I thought the optimum solution was to use the "whose
clause" whenever I could.
However, recently I learned that other methods, even repeat loops, can
sometimes be faster.
From Guidance on Sending Commands to Apps by Nigel
Garvey<http://forum.latenightsw.com/t/how-do-i-search-contacts-for-string-in-email-address/676/26?u=jmichaeltx>
________________________________
Most applications implementing 'whose' filters seem to stuggle when there are a
lot of items to filter. I don't know why, although one guess is that it may
have something to do with the filters being part of the AppleScript
implementations rather than what the applications offer normally. Where
performance is more important than scripting convenience, and where both the
data to be analysed and the data to be returned are AppleScript values, it can
make sense to have the application just dump everything relevant to the script
and let the script do the thinking, even though it will receive a lot more data
than otherwise and maybe require a lot more code.
________________________________
Another consideration, at least for me, is the simplicity of the code and ease
of maintenance. Macs are so fast today that even unoptimized code runs
quickly. I have a colleague who likes to say "Programmers time is often more
valuable than execution time". 😉 So, unless I expect to be in a situation
where I will be processing thousands of items/records, I tend to put ease of
coding, readability, and maintenance ahead of pure speed.
Often, if speed is a serious concern, then using ASObjC may be indicated.
Best Regards,
Jim Underwood
aka JMichaelTX
From: Olivier MARTINEAU
<email@hidden<mailto:email@hidden>>
Date: Monday, July 31, 2017 at 5:27 PM
To: Jim Underwood <email@hidden<mailto:email@hidden>>, "ASUL
(AppleScript)"
<email@hidden<mailto:email@hidden>>
Subject: RE: Position of an element in a list
Through the years my mind has slowly turned to systematically look for
non-iterative solutions.
Like (if I go to the end of my thought) iterative solutions being not that easy
to parallelize, they would not be ideal solutions.
Of course, as every blind generalization this might be wrong more often that I
know of.
_______________________________________________
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