<strike>6 times faster?</strike> (Re: Help w/ Code Optimization)by arhuman (Vicar)
|on Dec 26, 2001 at 22:27 UTC||Need Help??|
You might also try this :
The idea behind, is that '**' is MUCH slower than '*', so I exchange 2 '**' for one '**' and 2 '*'
It seems indeed to speed things alot :
(I'm sure your numerous tests will make it sure ;-)
gives as result :
Benchmark: timing 10 iterations of Root, Root2...
Root: 104 wallclock secs (104.38 usr + 0.01 sys = 104.39 CPU) @ 0.10/s (n=10)
Root2: 97 wallclock secs (92.67 usr + 0.16 sys = 92.83 CPU) @ 0.11/s (n=10)
Corrected my code! I misplaced the $t calculation outside the loop,
which is wrong beccause $guess change inside the loop.
As you can see it's no more so fast...
"Only Bad Coders Code Badly In Perl" (OBC2BIP)