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 load degrade 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.
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 ofadd
orload
degrade 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
overload
ed to call$table->stringify
. . . even contexts where stringification is not necessary. As a result, code that callsmy $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.