From 3c2e6c561ab890aa6f97d36d252fce1a634aba8f Mon Sep 17 00:00:00 2001 From: Ludovic 'Archivist' Lagouardette Date: Sun, 7 Jul 2019 00:34:45 +0200 Subject: [PATCH] added a madvise for record tables --- include/database.hpp | 2 ++ include/fsized_map.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/database.hpp b/include/database.hpp index 0ba8364..78bf0b2 100644 --- a/include/database.hpp +++ b/include/database.hpp @@ -87,6 +87,8 @@ public: tmp.clear(); + ret.records.enforce_caching(); + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wreturn-local-addr" return std::move(ret); diff --git a/include/fsized_map.h b/include/fsized_map.h index bb87860..9f4ea08 100644 --- a/include/fsized_map.h +++ b/include/fsized_map.h @@ -157,6 +157,10 @@ class mmap_array : public mmap_ptr posix_madvise(this->start, mapping_size, map_access); } + void enforce_caching() { + posix_madvise(this->start, mapping_size, MADV_WILLNEED); + } + constexpr size_t size() { return item_size; }