aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-09-21 18:22:45 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-09-21 18:22:45 +0200
commite8e1d420f364afbfface61d3f03889e10e6066c9 (patch)
tree2cd1a7637d516eb5d50501a5508231d979096cf7 /src/libexpr/eval.hh
parentcbe0bb29f4531b2cd6b18775018bf030b1a909e3 (diff)
Don't include <regex> in header files
This reduces compilation time by ~15 seconds (CPU time). Issue #4045.
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index 80078d8a5..0e1f61baa 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -6,7 +6,6 @@
#include "symbol-table.hh"
#include "config.hh"
-#include <regex>
#include <map>
#include <optional>
#include <unordered_map>
@@ -65,6 +64,11 @@ typedef std::list<SearchPathElem> SearchPath;
void initGC();
+struct RegexCache;
+
+std::shared_ptr<RegexCache> makeRegexCache();
+
+
class EvalState
{
public:
@@ -120,7 +124,7 @@ private:
std::unordered_map<Path, Path> resolvedPaths;
/* Cache used by prim_match(). */
- std::unordered_map<std::string, std::regex> regexCache;
+ std::shared_ptr<RegexCache> regexCache;
public: