Skip Menu |

This queue is for tickets about the MouseX-NativeTraits CPAN distribution.

Report information
The Basics
Id: 72549
Status: resolved
Priority: 0/
Queue: MouseX-NativeTraits

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.04
Fixed in: (no value)



Subject: Counter is slower than doing it by hand
I looked into MouseX::NativeTraits to find a faster counter. Turns out this counter is slower than doing it by hand. The attached benchmark illustrates. I was hoping it would be optimized like: sub inc_counter { return ++$_[0]->{counter}; }
Subject: test.plx
Download test.plx
application/octet-stream 536b

Message body not shown because it is not plain text.

Oh, sure. I guess it is because Counter's inc() have to accept an extra argument: $obj- Show quoted text
>inc(42).
I have optimized inc() in 1.05 for the case where isa => 'Int' and no trigger. On Sat Nov 19 03:15:19 2011, MSCHWERN wrote: Show quoted text
> I looked into MouseX::NativeTraits to find a faster counter. Turns out > this counter is slower than doing it by hand. The attached benchmark > illustrates. > > I was hoping it would be optimized like: > > sub inc_counter { > return ++$_[0]->{counter}; > }
-- Goro Fuji (gfx) GFUJI at CPAN.org
Resolved in 1.05. -- Goro Fuji (gfx) GFUJI at CPAN.org