[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: KSpread cells
From:       David Faure <david () mandrakesoft ! com>
Date:       2000-05-22 7:46:04
[Download RAW message or body]

I wondered about that too, yesterday. Let's see. KSpreadCell has

16 ints
1 double
9 bool
4 QString
1 pointer to cell
one QList (dependencies)
one Style
one Content
pointers to QSimpleRichText, KFormula, KSParseNode
cellprivate
3 pointers to KSpreadConditional

This is quite a lot indeed. This cries for inheritance, if you want my opinion.
Well, if a cell can only be rich text, _or_ a formula, _or_ a basic cell.
If it can be several at once, inheritance doesn't help.

Or perhaps more contained objects -> for instance for the 'obscuring cells'
and 'extra cells' stuff, which takes quite a lot ints in the count above,
even if not used.

On the bright side and to answer your question, yes, cells are only
created where there is something. You don't have 65536 cells created
for an empty document or something like that ;-)

What's the flyweight pattern ?

David, who realises he really needs to get a full time KDE job ;-)

On Mon, May 22, 2000 at 09:39:44AM +0200, Werner Trobin wrote:
> Hi!
> 
> As I was quite "amused" by the CSV killer document I wondered
> how much memory *one* KSpread cell consumes - I stopped counting
> at 200 bytes :(
> 
> Did I count wrong, or is a cell really that memory hungry? How
> many cells are created (i.e. there are only cell objects for cells
> holding a value,...)?
> 
> Do you think it would be worth some optimizing effort (i.e. flyweight
> pattern (at least for the cell formatting stuff) or something like
> that)?
> 
> -- 
> Werner Trobin - wtrobin@mandrakesoft.com

-- 
David FAURE
david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/
KDE, Making The Future of Computing Available Today

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic