Re: How to speed up execution time of this script
Re: How to speed up execution time of this script
- Subject: Re: How to speed up execution time of this script
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 10 Aug 2010 18:12:54 -0400
I don't believe the shell solution is untenable;it's that 20 seconds
to get a list of the files that is just ridiculous. If nothing else,
use the shell solution without the pattern to get the initial list and
then run Yvan's search across it. It should be much, much faster than
the Finder. OMM in a 10000-file folder this takes less than a third
of a second to return the entire list:
set fileList to paragraphs of (do shell script "ls " & quoted form of
posix path of myFolder)
On Tue, Aug 10, 2010 at 5:54 PM, Bert Groeneveld
<email@hidden> wrote:
> Thanks a lot to all that gave input to this post. Here is what I would like
> to say/ask:
>
> Yvan: I already thanked you for posting a very intelligent piece of code.
> Ed, thank you also, but the solution you suggest executes too slow.
> Oakley and Thomas, thanks.
> Shane, you (as usual ;) see exactly what I say.
> Carlos, thanks for your input. I will certainly invest your post, but not
> now. I will first start using one of the other solutions.
> Mark, thanks for your shell script solution. Unfortunately this executes too
> slow on a folder with more than 10000 images.
>
> The solution of Yvan works fine for me.
> - getting a list of filenames of a folder containing > 10000 images takes 20
> seconds. Since I only need to do this part just once, this execution time is
> no issue.
> - I need to process (in a repeat loop) several hundreds (maybe 1000) article
> numbers in a single script execution, and the "search engine" in Yvan's
> script works almost realtime.
>
> Now that the speed issue is eliminated, I would even like to extend the
> scripts' search engine capabilities by not only finding files that start
> with a given articlenumber but also files with a name that contains the
> articlenumber preceded by a dot (for example: 137.articlenumberPencil.jpg).
> My query would look like this: Find all filenames whose name starts with
> articlenumber or whose name contains .articlenumber.
> Any help with that is of course welcome, but I will certainly give it a try
> myself.
>
> Bert.
>
>
>
> On 10 aug 2010, at 01:11, Shane Stanley wrote:
>
>> On 10/8/10 3:28 AM, "Mark J. Reed" <email@hidden> wrote:
>>
>>> Why not filter it at this point...
>>
>> If you look at the original post, I think it suggests that he gets the
>> list
>> once, which takes 20 seconds courtesy the Finder, and presumably filters
>> it
>> multiple times. My *guess* is that filtering via the Finder each time is
>> likely to be about the slowest option possible, especially under 10.6.
>>
>>> But you can probably do much better with the shell:
>>
>> And you can probably skip the probably.
>>
>> --
>> Shane Stanley <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:
>>
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to 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:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Mark J. Reed <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:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden