[Kstars-devel] KDE/kdeedu/kstars/kstars/skyobjects
Khudyakov Alexey
alexey.skladnoy at gmail.com
Thu Jun 4 13:48:53 CEST 2009
On Thursday 04 of June 2009 15:04:24 Akarsh Simha wrote:
> On Thu, Jun 04, 2009 at 02:32:37PM +0400, Alexey Khudyakov wrote:
> > On Thursday 04 of June 2009 08:13:02 Akarsh Simha wrote:
> > > But the mix of malloc/free and C++ objects is done for time
> > > optimization. We checked that removing the ctor drastically increased
> > > speed of loading.
> > >
> > For quick and dirty implementation it gives about 2 fold speed increase in
> > DeepStarComponent::loadStaticStars().
> >
> > 230±40ms for memcpy
> > 440±80ms for naive C++ only implementation.
> >
> > There are other methods of more C++ flavour. Placement new for example.
>
> I remember reading about the placement new operator. Does that help
> here?
>
It's more matter of efficient constructors.
Placement new could help if we want to save allocations and allocate one
continous block for stars at once.
> > > I'll anyway check that it works. It's time for the KDE 4.3 release.
> > >
> > It should, because freshly constructed StarObject doesn't hold AuxData
>
> Right. I checked that it works.
>
> I don't know what's the best way to handle the AuxInfo free problem. I
> thought I could make StarBlock a friend of StarObject. Is that a good
> idea?
>
Call destructor. And QStrings could explode and leak too.
More information about the Kstars-devel
mailing list