Skip to content

Commit

Permalink
Significantly speed up applying GTFS-RT updates
Browse files Browse the repository at this point in the history
With the national feeds from CH, NL and NO the time to process the updates
goes down from about a minute to a second here. The cost of this was
dominated by vecvec::push_back in rt_timetable::add_rt_transport.
  • Loading branch information
vkrause committed Feb 27, 2024
1 parent bf9b9e9 commit 53709f2
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion include/nigiri/rt/rt_timetable.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ struct rt_timetable {
vector_map<bitfield_idx_t, bitfield> bitfields_;

// Location -> RT transports that stop at this location
vecvec<location_idx_t, rt_transport_idx_t> location_rt_transports_;
mutable_fws_multimap<location_idx_t, rt_transport_idx_t>
location_rt_transports_;

// Base-day: all real-time timestamps (departures + arrivals in
// rt_transport_stop_times_) are given relative to this base day.
Expand Down
1 change: 0 additions & 1 deletion src/rt/create_rt_timetable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ rt_timetable create_rt_timetable(timetable const& tt,
rtt.bitfields_ = tt.bitfields_;
rtt.base_day_ = base_day;
rtt.base_day_idx_ = tt.day_idx(rtt.base_day_);
rtt.location_rt_transports_.resize(tt.n_locations());
return rtt;
}

Expand Down
1 change: 0 additions & 1 deletion test/routing/rt_routing_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ TEST(routing, rt_raptor_forward) {
rtt.bitfields_ = tt.bitfields_;
rtt.base_day_ = date::sys_days{2019_y / May / 3};
rtt.base_day_idx_ = tt.day_idx(rtt.base_day_);
rtt.location_rt_transports_.resize(tt.n_locations());

transit_realtime::FeedMessage msg;

Expand Down
1 change: 0 additions & 1 deletion test/rt/gtfsrt_resolve_trip_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ TEST(rt, gtfs_rt_update) {
rtt.bitfields_ = tt.bitfields_;
rtt.base_day_ = date::sys_days{2019_y / May / 3};
rtt.base_day_idx_ = tt.day_idx(rtt.base_day_);
rtt.location_rt_transports_.resize(tt.n_locations());

// Create basic update message.
transit_realtime::FeedMessage msg;
Expand Down

0 comments on commit 53709f2

Please sign in to comment.