in reply to Re: need to optimize my sub routine
in thread need to optimize my sub routine
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: need to optimize my sub routine
by BrowserUk (Patriarch) on Feb 20, 2008 at 02:41 UTC | |
btw, $HoH{$p} = {%rec} isn't same as $HoH{$p} = \%rec ? No. The former creates a new anonymous hash by copying the contents of %rec into it, and then stores a reference to that anonymous hash into $HoH{$p}. The latter, just stores a reference to the existing %rec into $HoH{$p}. As %rec is declared within the while loop, you will get an empty hash each time the loop iterates and so there is no need to copy it's contents, just take a reference. No copying means less work, so more efficient. How much difference it makes will depend on how large the hashes are. On the evidence of the script, probably not much individually, but over many iterations it may be significant enough to be worth while. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
by convenientstore (Pilgrim) on Feb 20, 2008 at 04:05 UTC | |
I however, just took out the extra variable that I could just calculate later so I replaced it w/ next results were very good I also rearranged it according to yours and I got pretty good results as well I will run it few more times to see what's going on Also, your sample gave me good idea to get rid of some other cut+paste in the code.. Thanks!!!
| [reply] [d/l] [select] |