Repository navigation
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
Activity
daniel-j-h commentedon Feb 18, 2016
Hints
TheMarex commentedon May 7, 2016
This is implemented as part of #2385
TheMarex commentedon May 7, 2016
Landed.
daniel-j-h commentedon May 8, 2016
Did you try setting hints such as madvise or pre-faulting pages? I think the Boost.IOStream's mmap features are very basic only and do not support this. Boost.Interprocess' mapped_region is more advanced in this regard. (Otherwise ifdef and syscalls)
Squashed 'third_party/rapidjson/' changes from f54b0e47a..ab1842a2d
Squashed 'third_party/rapidjson/' changes from f54b0e47a..f9d53419e