Re: A puzzle
Re: A puzzle
- Subject: Re: A puzzle
- From: Philip Aker <email@hidden>
- Date: Fri, 21 Nov 2008 18:31:55 -0800
On 2008-11-21, at 16:38:37, Mark J. Reed wrote:
To go back to the timing issue, I thought I'd try comparing the same
algorithm across different interpreters on the same box (iMac Core 2
Duo 2GHz 3GB RAM running 10.5.5).
My version of Luther's TID="1" solution in AppleScript consistently
takes 34 seconds, while my Perl take on the same idea runs just over
1 second. Only one solution was slower than the Applescript: bash
takes about 50 seconds. (But the same script runs in 30 seconds or
less in ksh and zsh.) Of course, a C version is much faster than
anything else, clocking in at about 75 milliseconds.
Here's the results of what I tried OMM. All times in seconds.
c: 0.075
perl: 1.149
python: 2.404
ruby: 3.717
sbcl: 3.983
js: 5.080
awk: 6.128
tclsh: 6.934
rhino: 9.505
clisp: 17.151
ksh: 26.163
zsh: 30.365
osascript: 32.979
bash: 48.124
Happy to supply the code I used offlist to anyone interested... but
I suspect I've far exceeded anyone else's interest in this. :)
Is this a 1 shot run or an average? For instance, on my iMac 2.4 the
first run of 'time perl -le …' is 1.043 but thereafter settles in at
~0.852.
What is problematic for me is that AppleScript is always loaded, and
some interps like sh (i.e. bash), and perl may have already been run
during login and therefore their code will be cached and effectively
be preloaded. Also, is the C code dynamically allocating storage for
the result or is it using a pre-defined size?
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
_______________________________________________
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
References: | |
| >A puzzle (From: Michelle Steiner <email@hidden>) |
| >Re: A puzzle (From: Luther Fuller <email@hidden>) |
| >Re: A puzzle (From: "Mark J. Reed" <email@hidden>) |