Optimizing memory usage w/ HypterText package

mensanator at aol.com mensanator at aol.com
Wed Dec 5 14:58:49 EST 2007


On Dec 5, 1:35 pm, je.s.t... at hehxduhmp.org wrote:
> I've been using the HyperText module for a while now
> (http://dustman.net/andy/python/HyperText/), and I really like it.
>
> I've run into a situation where I have code to construct a table
> and while it is normally perfect, there are times where the table
> can get quite huge (e.g. 1000 columns, 100000 rows .... yes, the
> question of "how on earth would someone render this table?" comes
> up, but that's not the point here :) ), and the code I have generating
> this starts choking and dying from excessive RAM usage.

Duh.

>
> I'm curious if people see a better way of going about this task and/or
> believe that an alternative method of HTML generation here would be
> better.

Here's a hint: go look at comp.lang.python on Google Groups.
Note that up in the right corner it says "Topics 1-30 of 98305".
Why do you suppose there is no option to display ALL the topics,
and that you are limited to 100 at a time?

>
> A (possibly somewhat pseudocode, as I'm doing this by hand) small example
> of what I'm doing ...
>
> inputs = [A, List, Of, Values, To, Go, Into, A, Table]
> numcolumns = howManyColumnsIWant
>
> out = ht.TABLE()
> column = 0
> for input in inputs:
>     if (column == 0):
>         tr = ht.TR()
>     tr.append(ht.TD(input))
>     column += 1
>     if (column == numcolumns):
>         out.append(tr)
>         column = 0
>
> As I said, this works fine for normal cases, but I've run into some situations
> where I need this to scale not just into the hundreds of thousands but also
> well into the millions - and that's just not happening.  Is there a better
> way to do this (which involves direct HTML generation in Python), or am
> I SOL here?




More information about the Python-list mailing list