Closed mpadge closed 3 years ago
Before translation to C++
library (gtfsrouter)
packageVersion ("gtfsrouter")
#> [1] '0.0.5.1'
gtfs <- extract_gtfs ("./feeds/vbb.zip")
#> ▶ Unzipping GTFS archive
#> ✔ Unzipped GTFS archive
#> ▶ Extracting GTFS feed✔ Extracted GTFS feed
#> ▶ Converting stop times to seconds✔ Converted stop times to seconds
#> ▶ Converting transfer times to seconds✔ Converted transfer times to seconds
system.time (
tr <- gtfs_transfer_table (gtfs)
)
#> ▶ Finding neighbouring services for each stop
#> Loading required namespace: pbapply
#> ✔ Found neighbouring services for each stop
#> ▶ Expanding to include in-place transfers
#> ✔ Expanded to include in-place transfers
#> user system elapsed
#> 109.298 1.418 110.357
Created on 2021-06-28 by the reprex package (v2.0.0.9000)
After translation:
library (gtfsrouter)
packageVersion ("gtfsrouter")
#> [1] '0.0.5.4'
gtfs <- extract_gtfs ("./feeds/vbb.zip")
#> ▶ Unzipping GTFS archive
#> ✔ Unzipped GTFS archive
#> ▶ Extracting GTFS feed✔ Extracted GTFS feed
#> ▶ Converting stop times to seconds✔ Converted stop times to seconds
#> ▶ Converting transfer times to seconds✔ Converted transfer times to seconds
system.time (
tr <- gtfs_transfer_table (gtfs)
)
#> ▶ Finding neighbouring services for each stop✔ Found neighbouring services for each stop
#> user system elapsed
#> 9.252 0.831 9.461
dim(tr)
#> [1] 14170 4
Created on 2021-06-28 by the reprex package (v2.0.0.9000)
More than 10 times faster for this relatively huge transfer table with 14,170 transfers. Now finally entirely efficient enough to be generally useful.
Re-opening because current code just makes new transfer table, but does not append to original table if present, as in this code from @AlexandraKapp. Next commit will insert lines to append new values to old.
Coz's it's all way too slow, and very easily C++-able.Ref #14