diff --git a/include/util/static_rtree.hpp b/include/util/static_rtree.hpp index 291c35f4d41..cab4036fbc0 100644 --- a/include/util/static_rtree.hpp +++ b/include/util/static_rtree.hpp @@ -260,6 +260,7 @@ class StaticRTree boost::iostreams::mapped_file_source m_objects_region; // This is a view of the EdgeDataT data mmap'd from the .fileIndex file util::vector_view m_objects; + EdgeDataT tmp; public: StaticRTree() = default; @@ -462,6 +463,7 @@ class StaticRTree : m_coordinate_list(coordinate_list.data(), coordinate_list.size()), m_objects(mmapFile(on_disk_file_name, m_objects_region)) { + preheat(); } /** @@ -480,6 +482,7 @@ class StaticRTree { BOOST_ASSERT(m_tree_level_starts.size() >= 2); m_objects = mmapFile(on_disk_file_name, m_objects_region); + preheat(); } /* Returns all features inside the bounding box. @@ -761,6 +764,18 @@ class StaticRTree return treeindex.level == m_tree_level_starts.size() - 2; } + void preheat() + { + auto iter = m_objects.begin(); + auto end = m_objects.end(); + while (iter < end) + { + tmp = *(iter.get_ptr()); + // because os's page is unit of 4K + iter += LEAF_NODE_SIZE; + } + } + friend void serialization::read( storage::tar::FileReader &reader, const std::string &name, StaticRTree &rtree); diff --git a/include/util/vector_view.hpp b/include/util/vector_view.hpp index e2d7d038df3..394f4b927db 100644 --- a/include/util/vector_view.hpp +++ b/include/util/vector_view.hpp @@ -41,6 +41,7 @@ class VectorViewIterator : public boost::iterator_facade