davidmoten / rtree

Immutable in-memory R-tree and R*-tree implementations in Java with reactive api
Apache License 2.0
1.09k stars 211 forks source link

rtree2 #95

Open davidmoten opened 5 years ago

davidmoten commented 5 years ago

I've made a new version of rtree at https://github.com/davidmoten/rtree2. It has a different artifactId rtree2 and different package names so can co-exist with rtree if required.

Instead of supporting RxJava 2 API I've dropped the reactive API completely and now search methods return Iterables. You can then wrap the return with whatever reactive library you like. For instance for RxJava2:

Flowable.fromIterable(tree.search(rect))

One really interesting consequence of dropping the reactive approach in the API is that performance went down about 20% on search benchmarks. It seems that high request fast paths were performing really well and converting to Iterable which is like a request 1, request 1, etc Observable/Flowable is not as fast. Anyway I think the flexibility benefit and reduced dependencies is worth the performance hit. I'll keep looking for opportunities to bring perf up again.

Note also that I've dropped serialization because it's a big maintenance pain. You can do your own serialization and deserialize using bulk packing kindly contributed by @ambling in #67.

I've released rtree2 0.9-RC1 to Maven Central which you can try out.

plokhotnyuk commented 5 years ago

@davidmoten would it be interested for you to see rtree2 compared with previous implementation and others libraries?

This has a separated submodule with benchmarks and their result charts in the docs directory.

davidmoten commented 5 years ago

@plokhotnyuk good work on your part. I'll do a bit more perf work and then do a comparison by all means.