pszufe / OpenStreetMapX.jl

OpenStreetMap (*.osm) support for Julia 1.0 and up
MIT License
118 stars 24 forks source link

Speed up OSMData -> MapData #57

Closed blegat closed 2 years ago

blegat commented 2 years ago

Adding a @time at this line: https://github.com/pszufe/OpenStreetMapX.jl/blob/7a06505eac473fcba360687101676837a3537f46/src/parseMap.jl#L102 Before this PR, I get:

julia> get_map_data("/home/blegat/Downloads/andorra-latest.osm", use_cache=false);
  0.097901 seconds (222.99 k allocations: 50.380 MiB)

julia> get_map_data("/home/blegat/Downloads/andorra-latest.osm", use_cache=false);
  0.086140 seconds (222.99 k allocations: 50.380 MiB)

julia> get_map_data("/home/blegat/Downloads/andorra-latest.osm", use_cache=false);
  0.150200 seconds (222.99 k allocations: 50.380 MiB, 40.81% gc time)

julia> get_map_data("/home/blegat/Downloads/andorra-latest.osm", use_cache=false);
  0.090045 seconds (222.99 k allocations: 50.380 MiB)

After this PR, I get

julia> get_map_data("/home/blegat/Downloads/andorra-latest.osm", use_cache=false);
  0.026511 seconds (29.02 k allocations: 8.461 MiB)

julia> get_map_data("/home/blegat/Downloads/andorra-latest.osm", use_cache=false);
  0.027412 seconds (29.02 k allocations: 8.461 MiB)

julia> get_map_data("/home/blegat/Downloads/andorra-latest.osm", use_cache=false);
  0.027245 seconds (29.02 k allocations: 8.461 MiB)