[index] Rtree insert performance super slow on example

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[index] Rtree insert performance super slow on example

Mark McCann
I’m attempting to use the boost spatial index for the first time.  Typically, my program will need to build an rtree with about 500K or so boxes or points and then make many queries.  According to the the documentation, the time to insert 1 M boxes should be on the order of ~1 second:

http://www.boost.org/doc/libs/1_57_0/libs/geometry/doc/html/geometry/spatial_indexes/introduction.html

However, on my machines, I’m typically seeing index build times of > 30 seconds.

In this 2014 post: http://boost-geometry.203548.n3.nabble.com/index-rtree-news-tt4026001.html
Adam reports the follow run times from his benchmarking example for boxes and segments:

BOXES                   SEGMENTS
0.436803 seconds     0.468003 seconds pack 1000000
0.0624004 seconds   0.0780005 seconds query(B)* 100000 found 100046
1.43521 seconds     1.49761 seconds insert 1000000
0.748805 seconds   0.967206 seconds query(B) 100000 found 100046

However, i’m seeing performance that is ~20x slower when compiling and running the same code:
~/geometry/index/example] ./benchmark_experimental
2.73026 seconds - pack 1000000
1.32293 seconds - query(B) 100000 found 100046
34.0913 seconds - insert 1000000
10.7422 seconds - query(B) 100000 found 100046

My machine is older, but is this old enough to result in this massively slow performance?
I’m compiling on OS X 10.10 with a 2 x 2.93 GHz Quad-Core Intel Xeon  and 32 GB of DDR3 memory.  The machine is circa 2009, but it was absolutely the fastest available at the time.

Any help would be appreciated or pointers to old discussions that would help.

_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [index] Rtree insert performance super slow on example

Adam Wulkiewicz
Hi Mark,

Mark Mccann wrote:

> I’m attempting to use the boost spatial index for the first time.  Typically, my program will need to build an rtree with about 500K or so boxes or points and then make many queries.  According to the the documentation, the time to insert 1 M boxes should be on the order of ~1 second:
>
> http://www.boost.org/doc/libs/1_57_0/libs/geometry/doc/html/geometry/spatial_indexes/introduction.html
>
> However, on my machines, I’m typically seeing index build times of > 30 seconds.
>
> In this 2014 post: http://boost-geometry.203548.n3.nabble.com/index-rtree-news-tt4026001.html
> Adam reports the follow run times from his benchmarking example for boxes and segments:
>
> BOXES                   SEGMENTS
> 0.436803 seconds     0.468003 seconds pack 1000000
> 0.0624004 seconds   0.0780005 seconds query(B)* 100000 found 100046
> 1.43521 seconds     1.49761 seconds insert 1000000
> 0.748805 seconds   0.967206 seconds query(B) 100000 found 100046
>
> However, i’m seeing performance that is ~20x slower when compiling and running the same code:
> ~/geometry/index/example] ./benchmark_experimental
> 2.73026 seconds - pack 1000000
> 1.32293 seconds - query(B) 100000 found 100046
> 34.0913 seconds - insert 1000000
> 10.7422 seconds - query(B) 100000 found 100046
>
> My machine is older, but is this old enough to result in this massively slow performance?
> I’m compiling on OS X 10.10 with a 2 x 2.93 GHz Quad-Core Intel Xeon  and 32 GB of DDR3 memory.  The machine is circa 2009, but it was absolutely the fastest available at the time.
>
> Any help would be appreciated or pointers to old discussions that would help.

I'm assuming you're testing Boost 1.57.
What compiler are you using (probably clang) and what parameters are
passed into it?
Is optimization enabled?
Indeed in the documentation it's not mentioned that the optimization
level /O2 was enabled while gathering those results.

Regards,
Adam
_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [index] Rtree insert performance super slow on example

Mark McCann
Hi Adam,

Problem solved!

I am using clang: Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0

Ok, so I had no idea how important passing in an optimization flag was in some cases.  I just tried again with g++ -O2 as you suggest and I'm seeing a 35x speedup!  Crazy.  Thank you so much!  You might want to mention this is the documentation on Boost.  Here's the new results:

0.318146 seconds - pack 1000000
0.071993 seconds - query(B) 100000 found 100046
0.875472 seconds - insert 1000000
0.817668 seconds - query(B) 100000 found 100046

Adam Wulkiewicz wrote
> However, i’m seeing performance that is ~20x slower when compiling and running the same code:
> ~/geometry/index/example] ./benchmark_experimental
> 2.73026 seconds - pack 1000000
> 1.32293 seconds - query(B) 100000 found 100046
> 34.0913 seconds - insert 1000000
> 10.7422 seconds - query(B) 100000 found 100046
>
> My machine is older, but is this old enough to result in this massively slow performance?
> I’m compiling on OS X 10.10 with a 2 x 2.93 GHz Quad-Core Intel Xeon  and 32 GB of DDR3 memory.  The machine is circa 2009, but it was absolutely the fastest available at the time.
>
> Any help would be appreciated or pointers to old discussions that would help.

I'm assuming you're testing Boost 1.57.
What compiler are you using (probably clang) and what parameters are
passed into it?
Is optimization enabled?
Indeed in the documentation it's not mentioned that the optimization
level /O2 was enabled while gathering those results.

Regards,
Adam
Loading...