Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: parse only one sheet at time In Spreadsheet::ParseExcel

by Kenosis (Priest)
on Feb 01, 2013 at 00:57 UTC ( #1016418=note: print w/ replies, xml ) Need Help??


in reply to Re^3: parse only one sheet at time In Spreadsheet::ParseExcel
in thread parse only one sheet at time In Spreadsheet::ParseExcel

A memory benchmarking of the two modules supports better memory usage by Spreadsheet::ParseExcel::Stream for the task below on a 1.9M SS, 20 sheets, each having 500 x 26 cells filled:

use strict; use warnings; use Memchmark qw(cmpthese); use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::Stream; my $xls_file = 'Book1.xls'; cmpthese( Spreadsheet_ParseExcel_Stream => sub { my $xls = Spreadsheet::ParseExcel::Stream->new($xls_file); while ( my $sheet = $xls->sheet() ) { my $cellA1 = $sheet->row->[0]; } }, Spreadsheet_ParseExcel => sub { my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse($xls_file); for my $worksheet ( $workbook->worksheets() ) { my $cellA1 = $worksheet->get_cell( 0, 0 )->value; } } );

Results:

test: Spreadsheet_ParseExcel, memory used: 199147520 bytes test: Spreadsheet_ParseExcel_Stream, memory used: 17633280 bytes

As a side note, Spreadsheet::ParseExcel::Stream is a front end for Spreadsheet::ParseExcel, and its author asserts that its memory management is optimized.


Comment on Re^4: parse only one sheet at time In Spreadsheet::ParseExcel
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016418]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-12-21 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (106 votes), past polls