-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Description
We can possibly save the cost of a syscall in our StaticRtree here:
osrm-backend/include/util/static_rtree.hpp
Lines 445 to 460 in 908a9e9
| inline void LoadLeafFromDisk(const uint32_t leaf_id, LeafNode &result_node) | |
| { | |
| if (!leaves_stream.is_open()) | |
| { | |
| leaves_stream.open(m_leaf_node_filename, std::ios::in | std::ios::binary); | |
| } | |
| if (!leaves_stream.good()) | |
| { | |
| throw exception("Could not read from leaf file."); | |
| } | |
| const uint64_t seek_pos = sizeof(uint64_t) + leaf_id * sizeof(LeafNode); | |
| leaves_stream.seekg(seek_pos); | |
| BOOST_ASSERT_MSG(leaves_stream.good(), "Seeking to position in leaf file failed."); | |
| leaves_stream.read((char *)&result_node, sizeof(LeafNode)); | |
| BOOST_ASSERT_MSG(leaves_stream.good(), "Reading from leaf file failed."); | |
| } |
by using mmap to access the leaf node data.
This StackOverflow ticket: http://stackoverflow.com/a/5589622
talks about some of the tradeoffs. Because we do quite a lot of IO on each nearest-neighbor search, it's not clear to me whether we're a good candidate for mmap. We should measure this.
/cc @daniel-j-h
Metadata
Metadata
Assignees
Labels
No labels