Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Maintainer(s)' notes

If you are reporting a bug in Spreadsheet::ParseExcel here are some pointers

1) State the issues as clearly and as concisely as possible. A simple program or Excel test file (see below) will often explain the issue better than a lot of text.

2) Provide information on your system, version of perl and module versions. The following program will generate everything that is required. Put this information in your bug report.

    #!/usr/bin/perl -w

    print "\n    Perl version   : $]";
    print "\n    OS name        : $^O";
    print "\n    Module versions: (not all are required)\n";

    my @modules = qw(
                      Spreadsheet::ParseExcel
                      Scalar::Util
                      Unicode::Map
                      Spreadsheet::WriteExcel
                      Parse::RecDescent
                      File::Temp
                      OLE::Storage_Lite
                      IO::Stringy
                    );

    for my $module (@modules) {
        my $version;
        eval "require $module";

        if (not $@) {
            $version = $module->VERSION;
            $version = '(unknown)' if not defined $version;
        }
        else {
            $version = '(not installed)';
        }

        printf "%21s%-24s\t%s\n", "", $module, $version;
    }

    __END__

3) Upgrade to the latest version of Spreadsheet::ParseExcel (or at least test on a system with an upgraded version). The issue you are reporting may already have been fixed.

4) Create a small example program that demonstrates your problem. The program should be as small as possible. A few lines of codes are worth tens of lines of text when trying to describe a bug.

5) Supply an Excel file that demonstrates the problem. This is very important. If the file is big, or contains confidential information, try to reduce it down to the smallest Excel file that represents the issue. If you don't wish to post a file here then send it to me directly: jmcnamara@cpan.org

6) Say if the test file was created by Excel, OpenOffice, Gnumeric or something else. Say which version of that application you used.

7) If you are submitting a patch you should check with the maintainer whether the issue has already been patched or if a fix is in the works. Patches should be accompanied by test cases.

Asking a question

If you would like to ask a more general question there is the Spreadsheet::ParseExcel Google Group.

Report information
The Basics
Id: 42518
Status: resolved
Worked: 30 min
Priority: 0/
Queue: Spreadsheet-ParseExcel

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

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



Subject: lvalue substr() is slow
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Charset: utf8
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1232351836-29719-216"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 352
Download (untitled) / with headers
text/plain 352b
Hello, I have profiled my application using S::ParseExcel, and it is shown that lvalue substr() seems to make Spreadsheet::ParseExcel::Utility::ExcelFmt a bottleneck. The attached file simply replaces all the callings of lvalue substr() to those of 4-args substr(). Could you please apply it to Utility.pm? Regards, -- Goro Fuji (GFUJI at CPAN.org)
Subject: Utility.diff
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1232351836-29719-215"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: text/x-patch; name="Utility.diff"
Content-Disposition: inline; filename="Utility.diff"
Content-Transfer-Encoding: binary
Content-Length: 5074
Download Utility.diff
text/x-diff 4.9k
--- Spreadsheet-ParseExcel-0.44-orig/lib/Spreadsheet/ParseExcel/Utility.pm 2009-01-09 12:09:52.000000000 +0900 +++ Spreadsheet-ParseExcel-0.44/lib/Spreadsheet/ParseExcel/Utility.pm 2009-01-19 11:59:39.995710400 +0900 @@ -558,14 +558,14 @@ } #print "REP:$sRep ",$rItem->[0], ":", $rItem->[1], ":" ,$rItem->[2], "\n"; - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = $sRep; + substr( $sFmtRes, $rItem->[1], $rItem->[2], $sRep ); } } elsif ( ( $iFmtMode == 1 ) && ( $iData =~ /$sNUMEXP/ ) ) { if ( $#aRep >= 0 ) { while ( $aRep[$#aRep]->[0] eq ',' ) { $iCmmCnt--; - substr( $sFmtRes, $aRep[$#aRep]->[1], $aRep[$#aRep]->[2] ) = ''; + substr( $sFmtRes, $aRep[$#aRep]->[1], $aRep[$#aRep]->[2], '' ); $iData /= 1000; pop @aRep; } @@ -644,42 +644,42 @@ if ( $rItem->[0] =~ /([#0]*)([\.]?)([0#]*)([eE])([\+\-])([0#]+)/ ) { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = - MakeE( $rItem->[0], $iData ); + substr( $sFmtRes, $rItem->[1], $rItem->[2], + MakeE( $rItem->[0], $iData ) ); } elsif ( $rItem->[0] =~ /\// ) { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = - MakeBun( $rItem->[0], $iData, $iInt ); + substr( $sFmtRes, $rItem->[1], $rItem->[2], + MakeBun( $rItem->[0], $iData, $iInt ) ); } elsif ( $rItem->[0] eq '.' ) { $iLen--; $iPPos = $iLen; } elsif ( $rItem->[0] eq '+' ) { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = - ( $iData > 0 ) ? '+' : ( ( $iData == 0 ) ? '+' : '-' ); + substr( $sFmtRes, $rItem->[1], $rItem->[2], + ( $iData > 0 ) ? '+' : ( ( $iData == 0 ) ? '+' : '-' ) ); } elsif ( $rItem->[0] eq '-' ) { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = - ( $iData > 0 ) ? '' : ( ( $iData == 0 ) ? '' : '-' ); + substr( $sFmtRes, $rItem->[1], $rItem->[2], + ( $iData > 0 ) ? '' : ( ( $iData == 0 ) ? '' : '-' ) ); } elsif ( $rItem->[0] eq '@' ) { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = $iData; + substr( $sFmtRes, $rItem->[1], $rItem->[2], $iData ); } elsif ( $rItem->[0] eq '*' ) { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = ''; #REMOVE + substr( $sFmtRes, $rItem->[1], $rItem->[2], '' ); #REMOVE } elsif (( $rItem->[0] eq "\xA2\xA4" ) or ( $rItem->[0] eq "\xA2\xA5" ) or ( $rItem->[0] eq "\x81\xA2" ) or ( $rItem->[0] eq "\x81\xA3" ) ) { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = $rItem->[0]; + substr( $sFmtRes, $rItem->[1], $rItem->[2], $rItem->[0] ); # ($iData > 0)? '': (($iData==0)? '':$rItem->[0]); } elsif ( ( $rItem->[0] eq '(' ) or ( $rItem->[0] eq ')' ) ) { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = $rItem->[0]; + substr( $sFmtRes, $rItem->[1], $rItem->[2], $rItem->[0] ); # ($iData > 0)? '': (($iData==0)? '':$rItem->[0]); } @@ -707,8 +707,7 @@ else { $sRep = ''; } - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = - "\x00" . $sRep; + substr( $sFmtRes, $rItem->[1], $rItem->[2], "\x00" . $sRep ); } } $sRep = ( $iLen > 0 ) ? substr( $sNumRes, 0, $iLen ) : ''; @@ -721,11 +720,11 @@ for ( my $iIt = $#aRep ; $iIt >= 0 ; $iIt-- ) { my $rItem = $aRep[$iIt]; if ( $rItem->[0] eq '@' ) { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = $iData; + substr( $sFmtRes, $rItem->[1], $rItem->[2], $iData ); $iAtMk++; } else { - substr( $sFmtRes, $rItem->[1], $rItem->[2] ) = ''; + substr( $sFmtRes, $rItem->[1], $rItem->[2], $iData ); } } $sFmtRes = $iData unless ($iAtMk); @@ -742,7 +741,7 @@ if ( $sNum =~ /^([^\d]*)(\d\d\d\d+)(\.*.*)$/ ) { my ( $sPre, $sObj, $sAft ) = ( $1, $2, $3 ); for ( my $i = length($sObj) - 3 ; $i > 0 ; $i -= 3 ) { - substr( $sObj, $i, 0 ) = ','; + substr( $sObj, $i, 0, q{,} ); } return $sPre . $sObj . $sAft; }
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-29719-1232356722-1086.42518-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 505
Download (untitled) / with headers
text/plain 505b
On Mon Jan 19 02:57:20 2009, GFUJI wrote: Show quoted text
> Hello, > > I have profiled my application using S::ParseExcel, and it is shown that > lvalue substr() seems to make Spreadsheet::ParseExcel::Utility::ExcelFmt > a bottleneck.
Hi, I'm actually in the process of refactoring ExcelFmt() quite significantly. It would be useful to have a Benchmark.pm testcase if you have one since there is also the slowdown caused by the use of $& (RT 42425). If you have a benchmark testcase could you post it. John. --
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-29719-1232356722-1086.42518-6-0 [...] rt.cpan.org>
References: <RT-Ticket-42518 [...] rt.cpan.org> <rt-3.6.HEAD-29719-1232356722-1086.42518-6-0 [...] rt.cpan.org>
Message-ID: <efb9c59b0901200012w25d506b3u507d81c16321cc33 [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 6CFC123C11D for <bug-Spreadsheet-ParseExcel [...] rt.cpan.org>; Tue, 20 Jan 2009 03:12:20 -0500 (EST)
Received: (qmail 5312 invoked by uid 103); 20 Jan 2009 08:12:19 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 20 Jan 2009 08:12:19 -0000
Received: from mail-ew0-f21.google.com (HELO mail-ew0-f21.google.com) (209.85.219.21) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Jan 2009 00:12:16 -0800
Received: by ewy14 with SMTP id 14so1128097ewy.21 for <bug-Spreadsheet-ParseExcel [...] rt.cpan.org>; Tue, 20 Jan 2009 00:12:10 -0800 (PST)
Received: by 10.210.111.4 with SMTP id j4mr6290155ebc.170.1232439130316; Tue, 20 Jan 2009 00:12:10 -0800 (PST)
Delivered-To: cpan-bug+Spreadsheet-ParseExcel [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #42518] lvalue substr() is slow
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=MiMu9PobnnTSGhYl/oKZjJjmbVA3hdAnrYEqXEiOv6NZhMxlF8mQBvb3x5Hr8cF9eZ Zm/RQvLjBPginG9YO1xYqjw24BRCoWm3xlZY6IrkSWkMwj6VYSLNXophpAtHwkA1DW1v 3YkmY15a//W/eiTl6oK7LY5heREpyQ4faXB7Y=
Return-Path: <g.psy.va [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=fJL/gihV1w8JmvJgCLMeuSOEMDQ+IxO6rCgKoWNzuic=; b=jq7dp0gpcL1e3Y4Z5jfiCR1kG2BlSCbtKWQkuseEG4Jm62dulNsjJ0wXz0tKWgxjvD FCOiWvrv8Et/Uu51g99mcF3eemqH2QAAbTkjiQGswvtR18rspXwcHXONOEnOUygw1pwV d4kML+n/mVdxOnu6ym0kWzVJ+izxZ68Xe9Vks=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-Spreadsheet-ParseExcel [...] rt.cpan.org
X-Google-Sender-Auth: 7cfc761c52762136
Date: Tue, 20 Jan 2009 17:12:10 +0900
Sender: g.psy.va [...] gmail.com
X-Spam-Level: *
To: bug-Spreadsheet-ParseExcel [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Goro Fuji <gfuji [...] cpan.org>
RT-Message-ID: <rt-3.6.HEAD-29719-1232439148-635.42518-0-0 [...] rt.cpan.org>
Content-Length: 823
Download (untitled) / with headers
text/plain 823b
2009/1/19 John McNamara via RT <bug-Spreadsheet-ParseExcel@rt.cpan.org>: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=42518 > > > On Mon Jan 19 02:57:20 2009, GFUJI wrote:
>> Hello, >> >> I have profiled my application using S::ParseExcel, and it is shown that >> lvalue substr() seems to make Spreadsheet::ParseExcel::Utility::ExcelFmt >> a bottleneck.
> > > Hi, > > I'm actually in the process of refactoring ExcelFmt() quite significantly. > > It would be useful to have a Benchmark.pm testcase if you have one since there is also the > slowdown caused by the use of $& (RT 42425). > > If you have a benchmark testcase could you post it.
Oh, very good job! The excel files I profiled are private, but FYI, I profiled them with Devel::NYTProf, which is a nice, easy profiler. Regards, -- Goro Fuji (藤 吾郎)
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-29719-1232443175-110.42518-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 48
Hi, Fixed in version 0.46. Thanks, John. --


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.