wdtinc / mapbox-vector-tile-java

Java Mapbox Vector Tile Library for Encoding/Decoding
Apache License 2.0
149 stars 73 forks source link

Performance tuning #30

Open karussell opened 5 years ago

karussell commented 5 years ago

Thanks for this library!

I'm currently testing this to create MVT from a graphhopper routing engine storage. If I did nothing wrong your mapbox-vector-tile-java library is already roughly 10 times faster than https://github.com/ElectronicChartCentre/java-vector-tile which is really nice :) !

For bigger tiles fetching the geometry from the graphhopper storage takes around 0.5sec and this produces around 350 000 simple lines (a line going from junction to junction, i.e. with "from" and "to" Coordinate) and converting this into a MVT takes around 4 sec. See the experimental code I use (see update). Usually the lines gets more coordinates and are not just going straight from junction to junction, which I have neglect for now.

Is there a possibility to further improve speed via an index or using a Multiline or something else?

Update: See this work in progress

ShibaBandit commented 5 years ago

Thank you. Sorry for the late response here.

I think we have some options for performance improvements - optimization can currently happen before or after JtsAdapter#createTileGeometry(). Curious, what profiling output do you have available for your processing bottlenecks?

karussell commented 5 years ago

Thanks a lot for your reply - no need to sorry - I know how open source works :)

And this is really great news that there are possibilities as we'll highly likely embed this in GraphHopper to provide a debugging view of the graph in the browser, which is really cool & helpful for us.

See here how we utilized your MVTJ lib

Curious, what profiling output do you have available for your processing bottlenecks?

I just used our StopWatch in the PR mentioned above.

The problem with the current code is that the graphhopper code is mixed with MVTJ and a simple StopWatch won't work, but you can just try the code with and without MVTJ and you'll see that it is a big difference (I can also try again with a profiler but won't be able to do so in the next 2 weeks)

ShibaBandit commented 5 years ago

Hey, it's been a while so I thought I would check in. Were you ever able to profile/locate the performance bottlenecks that need improvement?

karussell commented 5 years ago

Unfortunately not yet. Currently we have merged this and plan to improve it later if it is a blocking issue.