On May 5, 6:49 pm, an...@[EMAIL PROTECTED]
(Anton Ertl)
wrote:
> William James <w_a_x_...@[EMAIL PROTECTED]
> writes:
> >On May 4, 2:13 am, m...@[EMAIL PROTECTED]
(Marcel Hendrix) wrote:
> >> cac <c...@[EMAIL PROTECTED]
> writes Re: The hardest Euler problem
> >> [..]
>
> >> >> Someone posted this PARI/GP solution to problem 12:
> >> >> n=0; until(numdiv(n*(n+1)/2) > 500, n++); n*(n+1)/2
> >> >> He said it took about 50ms on his Intel 2.52GHz.
>
> >> What else to expect with a built-in number-of-divisors function?
>
> >What else? We expect the Forth version to live up to
> >Jeff Fox's boast that rewriting a program in Forth
> >makes it 100 times smaller and 1000 times faster.
>
> For all the Project Euler problems, that's pretty easy if you follow
> Chuck Moore's principles and Jeff Fox's way of evaluating size and
> speed. I don't know them by heart, so I apologize if I get it wrong,
> but one of them is that you shouldn't do at run-time what you can do
> at compile-time, and you shouldn't do at compile-time what you can do
> at edit time. So, following these principles, one would work out the
> solution with pencil&paper, and then write it down as a Forth program.
> I.e., a single, not overly long number.
>
> Pu****ng that on the stack and even printing it to screen certainly
> does not take as long as 50ms on this kind of machine, 50us should not
> be too hard to achieve, so there's your factor 1000.
>
> Concerning size, if you count that like Jeff Fox, you have to also
> include the size of the PARI/GP system, and the libraries and the OS
> that it runs on in your total size, and compare that to the size of
> the ColorForth program plus ColorForth running on the bare metal;
> getting a factor 100 there should not be hard. Actually ColorForth is
> overkill for just printing a single number, so I guess Chuck Moore
> could have a simple system for doing just that ready in a few
> minuates, and it would be even smaller.
>
> But then he might consider making a program out of the solution to be
> useless overhead, and optimize that away, too; that would give us 0
> size and 0 run-time, and Jeff Fox would work long hours in writing
> down the 0s for the size reduction and speedup factors.
>
> - anton
> --
> M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
> comp.lang.forth FAQs:http://www.complang.tuwien.ac.at/forth/faq/toc.html
> New standard:http://www.forth200x.org/forth200x.html
> EuroForth
2008:http://www.complang.tuwien.ac.at/anton/euroforth/ef08.html
Anton, that's the funniest post I've read on clf in years! Too much
space time, methinks?
--
Regards
Alex McDonald


|