Boost logo

Geometry :

Subject: [ggl] rtree index
From: Hartmut Kaiser (hartmut.kaiser)
Date: 2009-06-18 22:02:43


> My name is Federico J. Fernandez.

Good to see you again, Federico!

> I worked in the rtree spatial index during 2008 Google Summer of Code.
> I see that now my code is included in GGL. I'm really happy about that.
>
> I've been talking with Barend this days about improving the index,
> focusing on performance optimization. So I have now some issues to
> address and I would like to share them with the list to receive
> suggestions.
>
> Let's start with the first. I use boost::shared_ptr<> in the tree nodes
> to have pointers to the child nodes (in fact a std::vector of
> children). Barend told me that this could have a very big performance
> penalty so we want to replace them. I don't know what could I use to
> have a similar behavior:
>
> - normal pointers (then I should take control of the memory management)
> - some kind of local storage (the problem here is that I should replace
> all the virtual functions that rely on pointers)
> - other ideas ?

boost::intrusive_ptr. The semantics are similar to shared_ptr, but they
don't require a separate memory allocation to maintain the reference count.

But what you should probably ask yourself in the first place is whether you
really need to share the pointers to the child nodes in the tree. If
ownership of the child nodes is well defined (and that's usually the case in
tree like structures) you normally don't need to keep reference counts. In
this case simple wrapper objects a la boost::scoped_ptr are very handy.

> I also want to know if you have any kind of "test" infrastructure,
> because I have some good tests from my GSoC work that I want to use to
> measure the improvements, and I don't know exactly where to put them.

I'm not sure what the guys are currently using, but Boost.Test is definitely
an option.

Regards Hartmut


Geometry list run by mateusz at loskot.net