Skip to content

Commit 06fc5ef

Browse files
storage shapes in paged data structures for improved performance on unordered files (#149)
* wip * wip * wip * increase max page size * sort by shape seq * fix tests * fix nigiri * remove unnecessary include * move seq to shape.cc * wip
1 parent 2a8ff06 commit 06fc5ef

File tree

22 files changed

+150
-135
lines changed

22 files changed

+150
-135
lines changed

.pkg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
[cista]
66
[email protected]:felixguendling/cista.git
77
branch=master
8-
commit=48210e6925658163952e458a4d13629ffdb0cea3
8+
commit=fabfc0cbcf07343a2e0c2def3009555b22f0ae46
99
[geo]
1010
[email protected]:motis-project/geo.git
1111
branch=master
1212
commit=0a14addf42e91b267906a156c9c2564935c03eaf
1313
[utl]
1414
[email protected]:motis-project/utl.git
1515
branch=master
16-
commit=77aac494c45d2b070e65fe712abc34ac74a91d0f
16+
commit=8bfa7fc4edc23f716173bdfbcab8294fcc31e457
1717
[miniz]
1818
[email protected]:motis-project/miniz.git
1919
branch=master

exe/import.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "nigiri/loader/load.h"
1111
#include "nigiri/loader/loader_interface.h"
1212
#include "nigiri/common/parse_date.h"
13-
#include "nigiri/shape.h"
13+
#include "nigiri/shapes_storage.h"
1414

1515
namespace fs = std::filesystem;
1616
namespace bpo = boost::program_options;
@@ -108,7 +108,8 @@ int main(int ac, char** av) {
108108

109109
auto shapes = std::unique_ptr<shapes_storage>{};
110110
if (vm.contains("shapes")) {
111-
shapes = std::make_unique<shapes_storage>(out_shapes);
111+
shapes = std::make_unique<shapes_storage>(out_shapes,
112+
cista::mmap::protection::WRITE);
112113
}
113114

114115
auto const start = parse_date(start_date);

include/nigiri/loader/gtfs/load_timetable.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "nigiri/loader/dir.h"
44
#include "nigiri/loader/loader_interface.h"
5-
#include "nigiri/shape.h"
65
#include "nigiri/types.h"
76

87
namespace nigiri {

include/nigiri/loader/gtfs/loader.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include "nigiri/loader/loader_interface.h"
4-
#include "nigiri/shape.h"
54

65
namespace nigiri::loader::gtfs {
76

include/nigiri/loader/gtfs/shape.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22

33
#include <string_view>
44

5-
#include "nigiri/shape.h"
65
#include "nigiri/types.h"
76

8-
namespace nigiri::loader::gtfs {
7+
namespace nigiri {
8+
struct shapes_storage;
9+
}
910

10-
struct shape_state {
11-
shape_idx_t index_{};
12-
std::size_t last_seq_{};
13-
};
11+
namespace nigiri::loader::gtfs {
1412

1513
struct shape_loader_state {
16-
hash_map<std::string, shape_state> id_map_{};
17-
vecvec<shape_idx_t, double> distances_{};
14+
hash_map<std::string, shape_idx_t> id_map_{};
15+
std::vector<std::vector<double>> distances_{};
1816
shape_idx_t index_offset_;
1917
};
2018

include/nigiri/loader/gtfs/shape_prepare.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
#include "nigiri/loader/gtfs/shape.h"
44
#include "nigiri/loader/gtfs/trip.h"
5-
#include "nigiri/shape.h"
6-
#include "nigiri/timetable.h"
5+
6+
namespace nigiri {
7+
struct shapes_storage;
8+
struct timetable;
9+
} // namespace nigiri
710

811
namespace nigiri::loader::gtfs {
912

include/nigiri/loader/hrd/loader.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "nigiri/loader/hrd/parser_config.h"
44
#include "nigiri/loader/loader_interface.h"
5-
#include "nigiri/shape.h"
65

76
namespace nigiri::loader::hrd {
87

include/nigiri/loader/load.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77

88
#include "nigiri/loader/build_footpaths.h"
99
#include "nigiri/common/interval.h"
10-
#include "nigiri/shape.h"
1110
#include "nigiri/timetable.h"
1211
#include "nigiri/types.h"
1312

13+
namespace nigiri {
14+
struct shapes_storage;
15+
}
16+
1417
namespace nigiri::loader {
1518

1619
struct assistance_times;

include/nigiri/loader/loader_interface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
#include "nigiri/loader/assistance.h"
77
#include "nigiri/loader/dir.h"
8-
#include "nigiri/shape.h"
98
#include "nigiri/types.h"
109

1110
namespace nigiri {
11+
struct shapes_storage;
1212
struct timetable;
13-
}
13+
} // namespace nigiri
1414

1515
namespace nigiri::loader {
1616

include/nigiri/rt/frun.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
#include "nigiri/common/interval.h"
99
#include "nigiri/location.h"
1010
#include "nigiri/rt/run.h"
11-
#include "nigiri/shape.h"
1211
#include "nigiri/stop.h"
1312
#include "nigiri/types.h"
1413

1514
namespace nigiri {
15+
struct shapes_storage;
1616
struct rt_timetable;
1717
struct timetable;
1818
} // namespace nigiri

0 commit comments

Comments
 (0)