[reportlab-users] Tons of table questions
Paul Barrass
paul.barrass at safeonlinebilling.com
Thu Feb 26 06:32:13 EST 2009
Dinu Gherman wrote:
> Hi,
>
> I guess this is the main (FAQ one) to start with... How can I make
> tables render more quickly?
I refer you again to my earlier post
http://two.pairlist.net/pipermail/reportlab-users/2008-October/007594.html
[Potential workaround for performance issues on VERY long tables.], and
the thread cited in that post
http://two.pairlist.net/pipermail/reportlab-users/2004-May/003019.html
[Large tables - exponentially increasing run times] which discusses the
O(n^2) behaviour. Both posts suggest that the idea is worth making a
note of in the documentation.
>
> Do plain strings instead of Paragraphs help?
I've found that plain text rather than Paragraphs leads to an
approximate doubling of rendering speed, I've also found that the extra
flexibility obtained by using a Paragraph (most notably word-wrapping,
but also more control over styling etc.) is worth the extra time, but YMMV
> Does it help to preset all column widths with fixed values? Is the
> LongTable class the solution?
I've always used fixed-width tables, so can't really comment from
experience, though I think the LongTable class works to improve
performance on the width-setting stage of Table generation.
> And finally, is there a workaround to speedup table rendering by
> splitting it into little chunks and concatenating them? In order
> for that to work one would need a table header that is shown only
> at the beginning of a new frame. Is that realistic?
This is, or at least was in 2004, the way to do it. I'm not sure if any
improvements to the Table splitting code have been made since then. My
workaround of wrapping the fragments in a PTOContainer allows table
headers (and I guess footers) to be used when the Table is split between
pages.
Paul Barrass.
More information about the reportlab-users
mailing list