Mailing List Archive

Performance problems while building tables
Hi,

using Embperl 2.2.0 with mod_perl 2.0.3 on a linux machine with perl
5.8.8, I have some performance problems with large tables. The code
which I have attached at the end of this message takes quite a long time
depending on the number of rows of the table. This is the time (in
seconds) embperl needs to process the code:
rows time
500 16
1000 63

With other words: When I have the double number of rows, I need the
double of the double time to process that. This behaviour has been
approved in several tests. As I sometimes have tables with 10000 and
more rows, I am not too lucky with that :-(
Am I doing something wrong? Can I do something to increase speed or do I
have to build the table with my own code in order to be faster?

Thanks in advance,

Andreas

This is the code:
[* $escmode=0; *]
[* $tabmode=18; $maxrow=10000; $maxcol=100;*]
<table border=0 bgcolor="fffffc" >
[* if ($row==0){ *]
<tr bgcolor="E0D8CD">
<th nowrap >[+ $head[$col] +]</th>
</tr>
<tr bgcolor="D9CFBF">
<th nowrap>[+ $subhead[$col] +]</th>
</tr>
[* } *]
[* if($bgcolor eq
"#EBE4DA"){$bgcolor="#DED6CB";}else{$bgcolor="#EBE4DA";} *]
<tr bgcolor=[+ $bgcolor +]>
<td nowrap [+ $td_attr[$col] +]>[+ $main_data[$row][$col] +]</td>
</tr>
</table>




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
RE: Performance problems while building tables [ In reply to ]
Hi,

Sorry for the late reply.

>
> using Embperl 2.2.0 with mod_perl 2.0.3 on a linux machine
> with perl 5.8.8, I have some performance problems with large
> tables. The code which I have attached at the end of this
> message takes quite a long time depending on the number of
> rows of the table. This is the time (in
> seconds) embperl needs to process the code:
> rows time
> 500 16
> 1000 63
>
> With other words: When I have the double number of rows, I
> need the double of the double time to process that.

I can reproduce this here.

This is because Embperl has to compute several parts of the table, just
to see that the array has ended (value is undef) and throw it away.

I have changed your code to:

<table border=0 bgcolor="fffffc" >
<tr bgcolor="E0D8CD">
<td nowrap >[+ $head[$col] +]</td>
</tr>
<tr bgcolor="D9CFBF">
<td nowrap>[+ $subhead[$col] +]</td>
</tr>

[$foreach $data (@main_data) $]
[* if($bgcolor eq
"#EBE4DA"){$bgcolor="#DED6CB";}else{$bgcolor="#EBE4DA";} *]
<tr bgcolor=[+ $bgcolor +]>
[- $i = 0 -]
[$ foreach $cdata (@$data) $]
<td nowrap [+ $td_attr[$i++ ] +]>[+ $cdata +]</td>
[$endforeach$]
</tr>
[$endforeach$]
</table>

This has only a factor of 3 instead of 4 when doubling the number of
rows. This is also not perfect, but at least better than before.

The optimizations Embperl uses to speed things up reverses itself for
such huge tables :-(

Gerald



** Virus checked by BB-5000 Mailfilter **





---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org