[Kstars-devel] KDE/kdeedu/kstars/kstars/skycomponents

Khudyakov Alexey alexey.skladnoy at gmail.com
Fri Jun 19 18:42:15 CEST 2009


On Пятница 19 июня 2009 08:40:20 Akarsh Simha wrote:
> On Thu, Jun 18, 2009 at 07:55:39PM +0000, Alexey Khudyakov wrote:
> > SVN commit 983693 by khudyakov:
> >
> > * Replace memcpy based copying in with more C++ "copying". Instead
> > pass reference to {starData,deepStarData} into StarBlock::addStar
> > and reinitialize star with it.
> >
> > Possible pitfalls. StarObject::init doesn't reset object name(s) but I
> > believe it's not real problem for stars which are swapped in/out since
> > they do not have name.
> >
> > Code is marginally faster when not dominated by I/O.
>
> Will not a QVector<StarObject> give you a lot of overhead because it
> has to find contiguous locations for StarObject as the array expands?
> Will QList be a better choice?
>
Why? No. This is the case when QVector is resized, but it never resized. Its 
size is set at construction time and after that never changes. In such 
circumstances QVector is slightly better that QList because
 1. There one indirection less. QList is pointer based AFAIR. 
 2. Memory is continuous. So there is less allocation/deallocations 
But they more or less equivalent.


More information about the Kstars-devel mailing list