The header file "exceptions/exceptions.hh" and the exception types in it is used by virtually every source file in Scylla, so excessive includes and templated code generation in this header could slow down the build considerably. Before this patch, all of the exceptions' constructors were inline in exceptions.hh, so source file using one of these exceptions will need to recompile the code, which is fairly heavy, using the fmt templates for various types. According to ClangBuildAnalyzer, 323 source files needed to materialize prepare_message<db::consistency_level,int&,int&>, taking 0.3 seconds each. So this patch moves the exception constructors from the header file exceptions.hh to the source file exceptions.cc. The header file no longer uses fmt. Unfortunately, the actual build-time savings from this patch is tiny - around 0.1%... It turns out that most of the prepare_message<> compilation time comes from fmt compilation time, and since virtually all source files use fmt for other header reasons (intentionally or through other headers), no compilation time can be saved. Nevertheless, I hope that as we proceed with more cleanups like this and eliminate more unnecessary code-generation-in-headers, we'll start seeing build time drop. Signed-off-by: Nadav Har'El <nyh@scylladb.com>
4.3 KiB
4.3 KiB