aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/fmt.cc
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-08-22 21:02:52 -0700
committerRebecca Turner <rbt@sent.as>2024-08-28 09:52:05 -0700
commit4d8984420788d6253d2fd9bfa3ada92be8bfd73b (patch)
treed5db726ff1b87672c01f04e27064d5188d27d45a /src/libutil/fmt.cc
parent422550fd68a5877534b1ca577fc3c7d89b6706dd (diff)
build: remove about 30 cpu-sec of compile time by explicit instantiation
Apparently the fmt contraption has some extremely popular overloads, and the boost stuff in there gets built approximately infinite times in every compilation unit. Change-Id: Ideba2db7d6bf8559e4d91974bab636f5ed106198
Diffstat (limited to 'src/libutil/fmt.cc')
-rw-r--r--src/libutil/fmt.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libutil/fmt.cc b/src/libutil/fmt.cc
new file mode 100644
index 000000000..400fb7ea0
--- /dev/null
+++ b/src/libutil/fmt.cc
@@ -0,0 +1,14 @@
+#include "fmt.hh" // IWYU pragma: keep
+
+template class boost::basic_format<char>;
+
+namespace nix {
+
+// Explicit instantiation saves about 30 cpu-seconds of compile time
+template HintFmt::HintFmt(const std::string &, const Uncolored<std::string> &s);
+template HintFmt::HintFmt(const std::string &, const std::string &s);
+template HintFmt::HintFmt(const std::string &, const uint64_t &, const char * const &);
+
+HintFmt::HintFmt(const std::string & literal) : HintFmt("%s", Uncolored(literal)) {}
+
+}