Comment 22 for bug 514808

Revision history for this message
xrg (xrg) wrote : Re: [Bug 514808] Re: account - Legal Statements - General Ledger Performance issue [memory leak?]

On Monday 05 April 2010, you wrote:
> The other 17 minutes (and >350mb of ram) are spent by the OpenERP python
> thread. It may be a problem with the RML engine itself: Maybe it does
> not scale well, or maybe it is lossing (not freeing) resources.

Allow me to barge in and remind you of another performance hog: frame
allocation. At languages such as Python, Java etc, where objects are
automatically allocated and freed (and especially when all vars. are objects),
there is a hidden cost of having each function call (aka stack frame). Also,
when a variable is introduced in the code, the memory manager needs to compute
its allocation. That is non-trivial. Freeing the stack after it's used
(assuming a garbage collector) is even more hard.

So, the trick is to keep highly repetitive tasks in "flat" code, where for-
loops are preferred and data is kept in local vars (not easy in python, where
even local vars contain volatile objects).