Re: A puzzle
Re: A puzzle
- Subject: Re: A puzzle
- From: Simon Topliss <email@hidden>
- Date: Sat, 22 Nov 2008 12:30:14 +0000
On 22 Nov 2008, at 11:53, Philip Aker wrote:
On 2008-11-22, at 03:36:57, Skeeve wrote:
Mark J. Reed schrieb:
But incorporating your idea takes it down under 1.5:
$ time perl -le 'for (0..999999) { $total += split(/1/,$_.0)-1 };
print $total'
600000
real 0m1.405s
user 0m1.403s
sys 0m0.002s
Now try this on your machine, please:
$ time perl -e 'for ($_=1000000;--$_;) { $count+= tr/1/1/; } print
$count'
600000
real 0m1.367s
user 0m0.905s
sys 0m0.013s
600000
real 0m0.242s
user 0m0.239s
sys 0m0.003s
$ time perl -e 'for ($_=1000000;--$_;) { $count+= tr/1/1/; } print
$count' 600000
600000
real 0m0.366s
user 0m0.205s
sys 0m0.007s
_______________________________________________
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