DeloitteOptimalReality / LightOSM.jl

A Julia package for downloading and analysing geospatial data from OpenStreetMap APIs.
https://deloitteoptimalreality.github.io/LightOSM.jl/docs
Other
47 stars 12 forks source link

Speed up `add_weights!` #38

Closed mmiller-max closed 3 years ago

mmiller-max commented 3 years ago

Speed up add_weights! by only having vectors of the indices and weight value, and calculating everything else within the for loop

Old

julia> @btime LightOSM.add_weights!($g, :distance);
  859.221 ms (115 allocations: 240.18 MiB)

julia> @btime LightOSM.add_weights!($g, :time);
  1.759 s (136 allocations: 257.18 MiB)

New

julia> @btime LightOSM.add_weights!($g, :distance);
  720.114 ms (30 allocations: 118.47 MiB)

julia> @btime LightOSM.add_weights!($g, :time);
  1.335 s (30 allocations: 118.47 MiB)
codecov-commenter commented 3 years ago

Codecov Report

Merging #38 (9ea8079) into master (e4ddcb3) will decrease coverage by 0.13%. The diff coverage is 88.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #38      +/-   ##
==========================================
- Coverage   59.04%   58.90%   -0.14%     
==========================================
  Files          11       11              
  Lines         835      825      -10     
==========================================
- Hits          493      486       -7     
+ Misses        342      339       -3     
Impacted Files Coverage Δ
src/graph.jl 59.06% <88.23%> (-0.61%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e4ddcb3...9ea8079. Read the comment docs.