On Aug 26, 2012, at 1:28 AM, njh@bandsman.co.uk via RT wrote:
Show quoted text> Queue: CHI
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=78536 >
>
> On 26/08/12 00:48, Jonathan Swartz via RT wrote:
>> <URL:
https://rt.cpan.org/Ticket/Display.html?id=78536>
>>
>> The third line will end up making a copy anyway, right? Can you explain
>> why it's especially bad for the copy to be in a passed variable as
>> opposed to a lexical variable? Thanks - Jon
>
> There would be only one copy, whereas at the moment there is also a copy
> on the stack. So the saving comes from copying onto and off the stack
> (speed improvement) and the copy on the stack (memory improvement).
> I've done plenty of investigations into this concept and found it really
> does help.
Ok, but this is only for set(), which hopefully is the uncommon case if you have a cache with a decent hit rate. Is there a way to reduce the copies for get()? e.g. by passing a reference where the value should be stored?
Still not convinced I want to do this, just wondering… :)
Thanks
Jon