v0.9.2: Performance
This version contains a performance improvement for the new nigiri core. The scale of the improvement depends on many factors such as dataset size or query type. To illustrate the differences between the different algorithms, a evaluation was done using a two week timetable of Germany, Switzerland and the Netherlands (each one as GTFS) and according OSM data.
In the follwing table Range 2h means that the departure time window was 2h, MCD is the multi-criteria Dijkstra contained in the routing
module, TB is the TripBased algorithm. Nigiri is the new MOTIS core which is based on the RAPTOR algorithm. The coordinate to coordinate case considers up to 15 min walking for the first and last leg. Big differences can be seen on the 99% percentile where the slowest queries are now more than one second faster (or 35%).
Start | Query | Router | Avg. | q50 | q80 | q90 | q99 |
---|---|---|---|---|---|---|---|
Coordinate → Coordinate | Range 2h | MCD | 2,321 ms | 1,709 ms | 3,647 ms | 4,829 ms | 10,131 ms |
Coordinate → Coordinate | Range 2h | TB | 1,952 ms | 1,909 ms | 2,742 ms | 3,173 ms | 4,416 ms |
Coordinate → Coordinate | Range 2h | nigiri v0.9.1 | 1,049 ms | 886 ms | 1,561 ms | 2,049 ms | 3,530 ms |
Coordinate → Coordinate | Range 2h | nigiri v0.9.2 | 802 ms | 699 ms | 1,157 ms | 1,485 ms | 2,303 ms |
Differences for station to station queries are not as distinctive but especially the improvement on the 99% quantile is significant (10% reduction). EA query type stands for earliest arrival query (called Ontrip
in the MOTIS API).
Start | Query | Router | Avg. | q50 | q80 | q90 | q99 |
---|---|---|---|---|---|---|---|
Station → Station | EA | MCD | 555 ms | 436 ms | 745 ms | 1,017 ms | 2,002 ms |
Station → Station | EA | TB | 583 ms | 465 ms | 943 ms | 1,230 ms | 1,950 ms |
Station → Station | EA | nigiri v0.9.1 | 209 ms | 206 ms | 290 ms | 338 ms | 428 ms |
Station → Station | EA | nigiri v0.9.2 | 203 ms | 202 ms | 272 ms | 311 ms | 382 ms |
Benchmarks were conducted on a AMD Ryzen 9 5900X 12-Core Processor with MOTIS built in Release
mode. MOTIS calculations were limited to 12 threads.
Steps to reproduce
# config.ini
modules=nigiri
modules=intermodal
modules=osrm
mode=batch
num_threads=12
dataset.no_schedule=true
intermodal.router=nigiri
osrm.profiles=motis/osrm-profiles/foot.lua
[import]
paths=schedule-nl:input/schedule/nl
paths=schedule-delfi:input/schedule/delfi
paths=schedule-swiss:input/schedule/swiss
paths=osm:input/osm.pbf
[nigiri]
geo_lookup=true
first_day=2023-05-16
num_days=14
# config-routing.ini
modules=routing
modules=intermodal
modules=osrm
modules=lookup
mode=batch
num_threads=12
intermodal.router=routing
osrm.profiles=motis/osrm-profiles/foot.lua
[dataset]
begin=20230516
num_days=14
cache_graph=true
adjust_footpaths=false
[import]
paths=schedule-nl:input/schedule/nl
paths=schedule-delfi:input/schedule/delfi
paths=schedule-swiss:input/schedule/swiss
paths=osm:input/osm.pbf
# config-tripbased.ini
modules=routing
modules=intermodal
modules=osrm
modules=lookup
modules=tripbased
mode=batch
num_threads=12
intermodal.router=tripbased
osrm.profiles=motis/osrm-profiles/foot.lua
[dataset]
begin=20230516
num_days=14
cache_graph=true
adjust_footpaths=false
[import]
paths=schedule-nl:input/schedule/nl
paths=schedule-delfi:input/schedule/delfi
paths=schedule-swiss:input/schedule/swiss
paths=osm:input/osm.pbf
Generate coordinate to coordinate range queries (backward):
./motis/motis generate -c config-routing.ini --search_dir backward --start_type intermodal_pretrip --start_modes osrm_foot-15 --dest_type coordinate --dest_modes osrm_foot-15 --routers /routing /nigiri /tripbased --out q_ipretrip_idest_TARGET.txt
Generate station to station earliest arrival queries (forward):
./motis/motis generate -c config-routing.ini --message_type=routing --start_type=ontrip_station --dest_type=station --routers /routing /nigiri /tripbased --search_dir forward --out q_ontrip_sdest_TARGET.txt
Run routings:
~/code/motis/cmake-build-relwithdebinfo-mimalloc/motis -c config.ini --batch_input_file q_ipretrip_idest_nigiri.txt --batch_output_file r_ipretrip_idest_nigiri_new.txt && \
./motis/motis -c config.ini --batch_input_file q_ipretrip_idest_nigiri.txt --batch_output_file r_ipretrip_idest_nigiri_09.txt && \
./motis/motis -c config-routing.ini --batch_input_file q_ipretrip_idest_routing.txt --batch_output_file r_ipretrip_idest_routing.txt && \
./motis/motis -c config-tripbased.ini --batch_input_file q_ipretrip_idest_tripbased.txt --batch_output_file r_ipretrip_idest_tripbased.txt
Show statistics:
./motis/motis analyze r_ipretrip_idest_nigiri_new.txt && \
./motis/motis analyze r_ipretrip_idest_nigiri_09.txt && \
./motis/motis analyze r_ipretrip_idest_routing.txt && \
./motis/motis analyze r_ipretrip_idest_tripbased.txt
What's Changed
- Fixes for RI Basis + RSL RT by @pablohoch in #330
- nigiri gtfs loader memory improvement + routing speedup by @felixguendling in #331
Full Changelog: v0.9.1...v0.9.2