[Xotcl] new methods, request for comment
Gustaf Neumann
neumann at wu.ac.at
Fri Apr 24 09:18:33 CEST 2015
Am 23.04.15 um 19:08 schrieb Victor Mayevski:
>
> nx/xotcl objects require much less memory when these are
> namespace-less
> (contain no children or per-object methods).
>
>
> I am trying to create a generic mechanism for ordered nested objects.
> Although it is true that objects with namespaces use more memory, I
> accept it as a trade off for flexibility I get. I really strive for a
> "natural" order of objects (after all that's what objects are supposed
> to do: be an analog for the real world). I am also trying to make it
> as unobtrusive as possible (without a tracking mechanism etc). The
> reason I wanted timestamps is that I could have naturally named
> objects, when needed.
i did some tests creating large trees (1 mio nodes).
The performance and memory consumption depends on the degree of the tree.
If one creates e.g. a tree of degree 16, then namespaced objects are
actually
the best, since only a small fraction of the nodes (the non-leaf nodes)
have
namespaces. The ordered composite requires some double bookkeeping:
no matter, how the objects are created, these are children of a (maybe
global namespace) and additionally, one has to maintain a list of
the children of the node. It is true that the inner nodes require
more memory, but one saves the extra bookkeeping.
This advantage vanishes when the degree of the tree is low.
For binary tree, half of the nodes have namespaces, ("#ns" below).
Time becomes worse, since in deep trees there are many inner
nodes, which are checked for existence.
If you have huge tree, i would certainly recommend to make
experiments, since the differences can be huge.
-g
Ordered Composite
degree #ns RSS micro secs per obj
2 0 1130 34.0
10 0 1010 14.0
16 0 1010 14.6
Namespaced objects
degree #ns RSS micro secs per obj
2 500,000 1020 57.7
10 100,000 725 17.7
16 62,500 716 15.5
More information about the Xotcl
mailing list