Skip Menu |

This queue is for tickets about the Perl6-Junction CPAN distribution.

Report information
The Basics
Id: 115049
Status: new
Priority: 0/
Queue: Perl6-Junction

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

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



Subject: [PATCH] Very simple constructor optimization
On big arrays it gives enormous speed-up: [ 1:34] C:\Users\xenu\Downloads\Perl6-Junction-1.60000.tar\Perl6-Junction-1.60000> perl a.pl Rate old new old 210/s -- -81% new 1085/s 417% -- Benchmark code: use strict; use warnings; use Benchmark qw/cmpthese/; use Perl6::Junction; use Perl7::Junction; # Perl6::Junction with my patch applied my @test_arr = 1..10000; cmpthese(1000, { new => sub { Perl7::Junction::any(@test_arr) eq '10000' }, old => sub { Perl6::Junction::any(@test_arr) eq '10000' }, })
Subject: perl6-junction-ref-optimization.patch
diff -ur old/lib/Perl6/Junction/Base.pm new/lib/Perl6/Junction/Base.pm --- old/lib/Perl6/Junction/Base.pm 2013-08-21 16:21:15.000000000 +0200 +++ new/lib/Perl6/Junction/Base.pm 2016-06-04 01:39:43.340395210 +0200 @@ -20,8 +20,8 @@ ); sub new { - my ( $class, @param ) = @_; - return bless \@param, $class; + my ( $class, $param ) = @_; + return bless $param, $class; } sub values { diff -ur old/lib/Perl6/Junction.pm new/lib/Perl6/Junction.pm --- old/lib/Perl6/Junction.pm 2013-08-21 16:21:15.000000000 +0200 +++ new/lib/Perl6/Junction.pm 2016-06-04 01:39:21.378724077 +0200 @@ -15,19 +15,19 @@ our %EXPORT_TAGS = ( ALL => [@routines] ); sub all { - return Perl6::Junction::All->new(@_); + return Perl6::Junction::All->new(\@_); } sub any { - return Perl6::Junction::Any->new(@_); + return Perl6::Junction::Any->new(\@_); } sub none { - return Perl6::Junction::None->new(@_); + return Perl6::Junction::None->new(\@_); } sub one { - return Perl6::Junction::One->new(@_); + return Perl6::Junction::One->new(\@_); } 1;