lfagundes/oosheet — Issue #3: Object construction too heavy
Author: tlundqvist
Created: 2011-11-15 12:15:04+00:00
State: open

I just upgraded to the 1.1 version but this issue concerns the overall design. Actually my small script (which sums up a lot of values in a 300x20 cell region) stopped working after upgrade. The reason is the heavy overhead in constructing new objects. For example, I used this inside a loop:

cell = startcell + (c,0)

to iterate over columns. This line creates a new OOSheet object (which is a reasonable implementation). However, from a performance and memory point of view, it is really troublesome. It seems that a new connection is initialized for each new object which is really unnecessary. My problem goes away if I use "cell.shift(1,0)" instead (no new object).

I suggest moving out the initialization code to a singleton helper class/object instead and try to make object construction (the clone function) really light-weight. An alternative would be a redesign of the base classes with a separation of the concepts of a session and cells/regions. What do you think? Maybe you are aware of these issues already?