Generated content: counters and quotes

Waldo Bastian bastian at kde.org
Wed Feb 16 18:40:00 GMT 2005


On Wednesday 16 February 2005 19:14, Leo Savernik wrote:
> Am Dienstag, 15. Februar 2005 22:47 schrieb Allan Sandfeld Jensen:
> > > additional member in RenderObject.
> >
> > Sounds interesting. Notice however that all lists and list-items now have
> > a counter attached.
>
> Yeah, but only estimated 2% of all render objects will be actual list
> items. That means, in a document containing 100000 render objects, we incur
> a space overhead of 400000 bytes. With a hashmap, we only use space for the
> purported 2% of counter-attached nodes, we only have 2000 bytes over (+
> overhead of the hashmap structures which we occur only once).
>
> > With a global structure we really just need a fast way to lookup:
> > name*render-node -> counter-node
>
> QPtrDict is a hashmap, so it's O(1). There should be a convenience method
> that allows accessing an associated counter node like
>
> xmlDocImpl()->attachedCounterNode(this)

Assuming your hash map is big enough, if it's too small it becomes O(n) again.

Also note that the overhead of doing a lookup in a QPtrDict is larger than 
doing a variable lookup, so I hope you don't want to do the lookup for each 
of the 100000 render objects in the above example. Maybe you have a bit free 
in RenderObject to record whether a node has a counter or not.

Cheers,
Waldo
-- 
bastian at kde.org   |   Free Novell Linux Desktop 9 Evaluation Download
bastian at suse.com  |   http://www.novell.com/products/desktop/eval.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20050216/8d189632/attachment.sig>


More information about the kfm-devel mailing list