Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I read another suggestion and have taken out the "my" declarations within the loops, and I moved the limit declaration outside of the for loops.
That brought me down from 305 to 264 seconds per ticker. (note that I am on a different machine that before - this is a laptop with an Athlon M 1G processor, half a gig of ram, WinXP, and Active State Perl. So using your suggestions to use my $tv = ( ($cv <=> $amt) == ($oper - 1) ); instead of the sub call. That, with the previous changes mentioned above, resulted in a new time of 289 seconds... so slower (and from what I can tell it corrupts the algorithm decision - so I'm going to scrap that one). So back to the way it was prior, and then replacing the for loops with foreach like you suggest gives me a new time of 237 seconds. So in the end I had a drop of nearly 70 seconds from what this code did prior to the optimizations. Over 2000 stocks that would save me over a day and a half of processing... but it is still not a huge difference (in comparison to what I saw in C that is). Had my mistakes being corrected brought the speed down to 20-30seconds per stock, I would have been very impressed - but for now, I still think I will use my method of coding it in Perl (perhaps sloppily) and then seeing from there what speed improvements are needed (if any) for it to be useful. UPDATE: Now that I'm back in on the P4 2G, I ran the updated code on that and it is now at 179 secs - previously at 196. I guess slight variations in speed changes come from the random loop variations each time it is run. Also I'm not sure what versions of ActiveState perl is on my laptop compared to here on this machine. For this code I've noticed that the Athlon tends to improve more easily than Intel - why that is, I don't know - perhaps cache sizes? No clue. In reply to Re: Re: Re: Confirming what we already knew
by AssFace
|
|