[geos-devel] Coordinate & Coordinate list (20% faster now)
Norman Vine
nhv at cape.com
Thu Nov 14 19:21:28 EST 2002
David Blasby writes:
> I tested my theory:
> >
> I changed CoordinateList's getAt(int) from:
>
> Coordinate CoordinateList::getAt(int pos)
> {
> moveTo(pos);
> return get();
> }
>
> to:
>
> Coordinate CoordinateList::getAt(int pos)
> {
> if ((pos>vect->size()-1) || (pos<0) )
> throw "Invalid argument: out of bounds\n" ;
> else
> current=pos;
> return (*vect)[current];
> }
I would like to see this written to be the equivalent of
Coordinate CoordinateList::getAt(int pos)
{
if ((pos>vect->size()-1) || (pos<0) )
throw "Invalid argument: out of bounds\n" ;
else
current=pos;
return &(*vect)[current];
}
Then we should see a 'N' instead of a '0.N' speed improvement factor
Cheers
Norman
More information about the geos-devel
mailing list