Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

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

Report information
The Basics
Id: 70879
Status: open
Priority: 0/
Queue: Spreadsheet-XLSX

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

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



Subject: $& used, leading to huge performance hit
Download (untitled) / with headers
text/plain 244b
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.
This is a simple patch, but it requires 5.10.
Subject: no-slowre.patch.txt
--- /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 is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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