• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sum of list?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sum of list?


  • Subject: Re: Sum of list?
  • From: Martin Orpen <email@hidden>
  • Date: Thu, 01 Jul 2004 09:30:14 +0100

on 30/6/04 11:15 pm, Nigel Garvey at email@hidden
wrote:

> I'm on my old 4400 at the moment, where the difference is quite marked,
> even with just 50000 integers. (Longhand version:3.568 seconds, nested
> loops:5.571 seconds.) The point of the longhand method is to reduce the
> amount of time the script spends executing loop instructions. On my
> machines, at least, it takes less time to do one iteration with 19
> additions than to do ten iterations with 1 addition each. The difference
> isn't very much on my PowerBook, but it does make the difference between
> being faster or slower than 'statlist'. ;-)

You're right of course - scripting on 1.25GHz laptops and then later testing
them on G5s has made me rather lazy.

As has access to the shell. At the merest hint of a difficult sum I find
myself automatically typing echo pipe bc.

[snip]

> It wouldn't even be worth optimising ((n * (n + 1)) / 2) to ((n * n + n)
> div 2). ;-)

Oh, it would be, and It highlights another of my failings - given a choice
of two variations, I'll take the one that looks good as a piece of
typography in the editor window every time :-)

Regards

--
Martin Orpen
Idea Digital Imaging Ltd -- The Image Specialists
http://www.idea-digital.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: strange behaviour in search for \n
  • Next by Date: Re: strange behaviour in search for \n
  • Previous by thread: Re: strange behaviour in search for \n
  • Next by thread: Re: Applescript and Resource forks
  • Index(es):
    • Date
    • Thread