[Kst] : Huge performance problem under Windows
Barth Netterfield
netterfield at astro.utoronto.ca
Thu Nov 19 18:26:18 CET 2009
On November 19, 2009 12:10:57 pm Peter Kümmel wrote:
> As I understand it the object store is not global, but
> many classes have an instance of it (search for "ObjectStore *_").
Not formally, but it is effectively, since it can be gotten from anywhere via
the app/doc/etc. As it is used as a global, It would be just as well, from my
point of view, to be done with all the _store pointers and make it a global.
There is only one of them after all.
> Anyway, as you said, using reference counted pointers should make
> ObjectStore superfluous. A container of refcounted pointers should be enough.
That is effectively what it is, with extra code globbed on to make adding and
removing things... worse?
> And I also don't like all the casting when getting a object from
> the store, we are not using Java, with a master class 'Object', or
> Objective-C with 'NSObject'. One advantage of using C++ is to check at
> compile-time for type-correctness not at runtime, with the help of
> templates.
Most of the casting is related to finding all of the objects of a certain type.
Sometime you want
All Objects
or
All Primitives
of
All Scalars
of
All DataScalars
One list + dynamic casts makes this possible (if annoying). Some of the
helper template functions in ObjectStore are designed to take care of this.
> A first fix would be to replace all ObjectStore member variables with
> a container holding QSharedPtrs. This also makes the code more
> readable.
ie, take stuff out of ObjectStore that doesn't belong there, and use QT's lists
as is. I think we do want the template functions which return typed sub-
lists.
I think we would prefer QExlicitlySharedPtrs though... what do you think?
cbn
More information about the Kst
mailing list