This queue is for tickets about the Spreadsheet-XLSX CPAN distribution.

Report information
The Basics
Id:
70879
Status:
open
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
stuart [...] morungos.com
Cc:
AdminCc:

BugTracker
Severity:
Important
Broken in:
0.13
Fixed in:
(no value)



Subject: $& used, leading to huge performance hit
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 244
The code uses $'. This inflicts a huge performance hit on all code that uses it. Use Devel::SawAmpersand to test this, and Perl 5.10+ contains many alternatives. Since this is critical to us, I will probably put together a proposed patch.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
Content-Type: multipart/mixed; boundary="----------=_1442504359-28858-2"
Message-ID: <rt-4.0.18-28858-1442504359-40.70879-0-0@rt.cpan.org>
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 46
This is a simple patch, but it requires 5.10.
MIME-Version: 1.0
Subject: no-slowre.patch.txt
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Type: text/plain; charset="utf-8"; name="no-slowre.patch.txt"
Content-Disposition: inline; filename="no-slowre.patch.txt"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 2332
--- /usr/share/perl5/vendor_perl/Spreadsheet/XLSX.pm 2015-09-17 11:33:50.982004053 -0400 +++ XLSX.pm 2015-09-17 11:33:39.087002666 -0400 @@ -1,6 +1,6 @@ package Spreadsheet::XLSX; -use 5.006000; +use 5.010000; use strict; use warnings; @@ -106,9 +106,9 @@ foreach ($member_workbook -> contents =~ /\<(.*?)\/?\>/g) { - /^(\w+)\s+/; + /^(\w+)\s+/p; - my ($tag, $other) = ($1, $'); + my ($tag, $other) = ($1, ${^POSTMATCH}); my @pairs = split /\" /, $other; --- /usr/share/perl5/vendor_perl/Spreadsheet/XLSX/Utility2007.pm 2015-09-17 11:33:46.646003205 -0400 +++ Utility2007.pm 2015-09-17 11:33:42.959001952 -0400 @@ -178,9 +178,9 @@ ) { $iFmtMode = 1 unless($iFmtMode); if(substr($sFmtObj, $i, 1) =~ /[#0]/) { - if(substr($sFmtObj, $i) =~ /^([#0]+)([\.]?)([0#]*)([eE])([\+\-])([0#]+)/){ - push @aRep, [substr($sFmtObj, $i, length($&)), $i, length($&)]; - $i +=length($&); + if(substr($sFmtObj, $i) =~ /^([#0]+)([\.]?)([0#]*)([eE])([\+\-])([0#]+)/p){ + push @aRep, [substr($sFmtObj, $i, length(${^MATCH})), $i, length(${^MATCH})]; + $i +=length(${^MATCH}); } else{ if($iFflg==-1) { @@ -218,9 +218,9 @@ $iFflg = -1; } elsif(substr($sFmtObj, $i, 3) =~ /^[eE][\+\-][0#]$/) { - if(substr($sFmtObj, $i) =~ /([eE])([\+\-])([0#]+)/){ - push @aRep, [substr($sFmtObj, $i, length($&)), $i, length($&)]; - $i +=length($&); + if(substr($sFmtObj, $i) =~ /([eE])([\+\-])([0#]+)/p){ + push @aRep, [substr($sFmtObj, $i, length(${^MATCH})), $i, length(${^MATCH})]; + $i +=length(${^MATCH}); } $iFflg = -1; } @@ -455,8 +455,8 @@ elsif($rItem->[0] eq '.') { $sRep = '.'; } - elsif($rItem->[0] =~ /^0+$/) { - my $i0Len = length($&); + elsif($rItem->[0] =~ /^0+$/p) { + my $i0Len = length(${^MATCH}); #print "SEC:", $aTime[7], "\n"; $sRep = substr(sprintf("%.${i0Len}f", $aTime[7]/1000.0), 2, $i0Len); }


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.