Re: Days and hours
Re: Days and hours
- Subject: Re: Days and hours
- From: Emmanuel <email@hidden>
- Date: Thu, 20 Oct 2005 18:25:06 +0200
At 1:19 AM -0400 10/20/05, Mark J. Reed wrote:
FYI, some timing results for 5,000 iterations on my Tiger mini.
Note that in the case of the shell scripts, in each case I pre-built
the entire command line outside the loop and did nothing but "do
shell script cmdString" in the loop body.
Mark, you're doing 5000 iterations because maybe your timer is not
fine enough: if you use "chrono" one iteration is enough (chrono
resolves approx. 1/10 ms). The reason I mention that is that the
first time you launch a command it will be longer, or very much
longer, to run than the second time.
do shell script "php -r \"echo dirname(" & quoted form of POSIX path
of someFile & ");\"": 272 seconds
tell application "Finder" to get folder of someFile: 88 seconds
do shell script "dirname " & quoted form of POSIX path of someFile: 79 seconds
do shell script "f=" & quoted form of POSIX path of someFile & ";
echo \"${f%/*}\"": 62 seconds
You've forgotten one candidate, Smile's "change", and I'm glad to
observe that this is the faster. Here are my results (with one
iteration only.)
chrono
do shell script "php -r \"echo dirname(" & quoted form of POSIX path
of someFile & ");\""
chrono -- 0.06
chrono
tell application "Finder" to get folder of someFile
chrono -- 0.003
chrono
do shell script "dirname " & quoted form of POSIX path of someFile
chrono -- 0.02
chrono
do shell script "f=" & quoted form of POSIX path of someFile & ";
echo \"${f%/*}\""
chrono -- 0.02
chrono
change ":[^:]+$" into "" in (someFile as text) with regexp
chrono -- 0.0015
Emmanuel
_______________________________________________
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