Skip Menu |

This queue is for tickets about the Text-Table CPAN distribution.

Report information
The Basics
Id: 116525
Status: resolved
Priority: 0/
Queue: Text-Table

People
Owner: Nobody in particular
Requestors: zbbentley [...] gmail.com
Cc:
AdminCc:

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



Subject: Overloading results in progressively degraded performance while adding rows to a table in a loop
Date: Wed, 27 Jul 2016 08:44:26 -0400
To: bug-text-table [...] rt.cpan.org
From: Zac Bentley <zbbentley [...] gmail.com>
This is a reference to Github issue #3: https://github.com/shlomif/Text-Table/issues/3 If I loop and add one row at a time to a table that will eventually contain thousands of rows, while checking (via if ($table)) if a table exists before adding data, I see performance of add or loaddegrade as a function of the square of the number of rows (perl 5.16, strict/warnings, x86-64 linux). The table I'm working with has a handful of columns and pretty ordinary data (plus some ASCII colors) in the rows; cells are at most 20chr wide. This appears to be because too many caller contexts get overloaded to call $table->stringify . . . *even contexts where stringification is not necessary*. As a result, code that calls my $data = get_data(); if ( $table && $data ) { $table->load($data); } in a long loop is actually calling the stringification function for the table each time the loop spins. This results (at row 1) in iterations being fast, and later (at row 1000) in iterations sometimes taking more than a second. This seems undesirable.
On Wed Jul 27 08:44:55 2016, zbbentley@gmail.com wrote: Show quoted text
> This is a reference to Github issue #3: > https://github.com/shlomif/Text-Table/issues/3 >
Already fixed on GitHub and on CPAN. closing here too, thanks! Show quoted text
> If I loop and add one row at a time to a table that will eventually contain > thousands of rows, while checking (via if ($table)) if a table exists > before adding data, I see performance of add or loaddegrade as a function > of the square of the number of rows (perl 5.16, strict/warnings, x86-64 > linux). > > The table I'm working with has a handful of columns and pretty ordinary > data (plus some ASCII colors) in the rows; cells are at most 20chr wide. > > This appears to be because too many caller contexts get overloaded to call > $table->stringify . . . *even contexts where stringification is not > necessary*. As a result, code that calls my $data = get_data(); if ( $table > && $data ) { $table->load($data); } in a long loop is actually calling the > stringification function for the table each time the loop spins. > > This results (at row 1) in iterations being fast, and later (at row 1000) > in iterations sometimes taking more than a second. > > This seems undesirable.