mattwigway / OSRM.jl

MIT License
2 stars 0 forks source link

route() allocates a lot #7

Open mattwigway opened 1 year ago

mattwigway commented 1 year ago

Using a Minneapolis/St Paul graph:

@time r = route(osrm, LatLon(45.00953841934274, -93.34136074101534), LatLon(44.93390044815157, -93.21460645682946));
  0.003647 seconds (2.83 k allocations: 190.398 KiB)

@time doesn't track allocations made in C code, so these allocations are all coming from Julia - mostly the parse_routes function and the functions it calls. It's not going to be possible to eliminate all allocations (we're parsing something into a data structure of arbitrary length), but this seems excessive and leads to large GC pauses when route() is called many times.

Adding an option to not calculate all of the steps and just return a geometry will help, as not all applications require all the steps.