any perl performance experts awake?
Lonni J Friedman
netllama at gmail.com
Thu Apr 11 18:02:59 PDT 2013
On Thu, Apr 11, 2013 at 4:35 PM, James McDonald
<james at jamesmcdonald.id.au> wrote:
> Enjoyed this thread...
>
> So passing $hash{key} is expensive because it does a copy of the hash but
> passing $hash_ref->{key} stops the expensive copy operation.
yea, basically. Although it needs to be passed into the subroutine as
\%hash so that its a reference.
>
>
> On 12 April 2013 06:40, Andrew Gould <andrewlylegould at gmail.com> wrote:
>>
>> On Thu, Apr 11, 2013 at 3:37 PM, Lonni J Friedman <netllama at gmail.com>
>> wrote:
>>>
>>> I figured this out. It was definitely the hash table lookups that
>>> were the problem. Or more accurately, the fact that I was passing the
>>> entire hash table into the subroutine thousands of times, which meant
>>> it was being copied thousands of times. I switched to using a
>>> hashref, and that cut the processing time from hours to a few minutes.
>>>
>>
>> Yeah!
>>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman netllama at gmail.com
LlamaLand https://netllama.linux-sxs.org
More information about the Linux-users
mailing list