Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: Re: Re: Re: Confirming what we already knewby l2kashe (Deacon) |
on Mar 05, 2003 at 14:50 UTC ( [id://240588]=note: print w/replies, xml ) | Need Help?? |
You might be able to achieve a huge performance gain by taking your algorithms and memoizing them. I.e
You could even turn this into a sub function, which takes a string as an argument, shifts it as it goes, determines what to do with the different expressions on the line, and then returns the final result. Thinking about that though.. You would need to add logic to deal with precedence, and parentheses. Also it would be very expensive to start, but once you are through a fair portion of your data, it will really help This is probably a very poor example, and could be cleaned/optimized, but you see the point I hope. Floating point math is always leaps and bounds slower then interger math. On top of that you moved from a windows machine to a FreeBSD machine. The kernel architecture, memory management, threading mechanisms, as well as application overhead all play massive roles in how your code will perform, especially in regards to loops such as you are talking about. Also as long as the data sets do not rely on each other, you could take all your data, parse it, store it in a hash or array, then take slices of those structures and fork off seperate processes which can do the computations in parallel, and then collect the results from files, or even share memory space, and have them all report back when they are done if you have ithreads enabled, and know how to use them. I really am interested to see your code, much like other monks. I have started a few threads about speed, and squeezing the last bit I can out of perl. I've received great help and optimizations, which have also allowed me to peer a little deeper into how perl works and what it likes to see. It really does worry me, just like the other monks have stated, that your perl code looks like your C code. You could be missing out on some really great stuff there. O well just my 2 cents.. /* And the Creator, against his better judgement, wrote man.c */
In Section
Meditations
|
|