[Edu-sig] Brute force solutions
Peter Bowyer
peter at mapledesign.co.uk
Wed Sep 21 19:44:01 CEST 2005
At 14:33 21/09/2005, you wrote:
>At the cost of roughly doubling the complexity of the code (19 lines instead
>of ten lines in the function body), I was able to improve the performance by
>a factor of more than 6500, while basically still using the same
>"brute-force" approach of guessing a number, adjusting the guess by a delta,
>and noticing which number gets the lowest error.
Psyco also makes a very noticeable difference:
Without:
Slow method -- result: 1.61803406588 time: 1.40232660855 seconds
Faster method -- result: 1.6180333003 time: 0.000200135212716 seconds
2 digits more precision -- result: 1.61803398295 time:
0.000242882824493 seconds
With psyco.full()
Slow method -- result: 1.61803406588 time: 0.256314531595 seconds
Faster method -- result: 1.6180333003 time: 3.65800681372e-005 seconds
2 digits more precision -- result: 1.61803398295 time:
4.53755994128e-005 second
--
Maple Design - quality web design and programming
http://www.mapledesign.co.uk
More information about the Edu-sig
mailing list