Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-10-03 17:05:19 +0300
committerJacques Lucke <jacques@blender.org>2021-10-03 17:05:19 +0300
commita812fe8ceb75fd2befe44a151f1e214f357c24c2 (patch)
tree2982cae2d66b7718de88603816bb93a77abba308 /source/blender/nodes/NOD_socket_declarations.hh
parent2f52f5683ca8454a32c8f9f9e47c56092070e114 (diff)
Nodes: use extern templates for socket declarations
The new socket declaration api generates a surprising amount of symbols in each translation unit where it is used. This resulted in a measurable compile time increase. This commit reduces the number of symbols that are generated in each translation unit significantly. For example, in `node_geo_distribute_points_on_faces.cc` the number of symbols decreased from 1930 to 1335. In my tests, this results in a 5-20% compile time speedup when this and similar files are compiled in isolation (measured by executing the command in `compile_commands.json`). Compiling the distribute points on faces node sped up from ~2.65s to ~2.4s.
Diffstat (limited to 'source/blender/nodes/NOD_socket_declarations.hh')
-rw-r--r--source/blender/nodes/NOD_socket_declarations.hh21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_socket_declarations.hh b/source/blender/nodes/NOD_socket_declarations.hh
index 3f7f9e0414e..6eac77b1d6b 100644
--- a/source/blender/nodes/NOD_socket_declarations.hh
+++ b/source/blender/nodes/NOD_socket_declarations.hh
@@ -330,3 +330,24 @@ inline Texture::Texture() : IDSocketDeclaration("NodeSocketTexture")
}
} // namespace blender::nodes::decl
+
+/* --------------------------------------------------------------------
+ * Extern template instantiations that are defined in `intern/extern_implementations.cc`.
+ */
+
+namespace blender::nodes {
+#define MAKE_EXTERN_SOCKET_DECLARATION(TYPE) \
+ extern template class SocketDeclarationBuilder<TYPE>; \
+ extern template TYPE::Builder &NodeDeclarationBuilder::add_input<TYPE>(StringRef, StringRef); \
+ extern template TYPE::Builder &NodeDeclarationBuilder::add_output<TYPE>(StringRef, StringRef);
+
+MAKE_EXTERN_SOCKET_DECLARATION(decl::Float)
+MAKE_EXTERN_SOCKET_DECLARATION(decl::Int)
+MAKE_EXTERN_SOCKET_DECLARATION(decl::Vector)
+MAKE_EXTERN_SOCKET_DECLARATION(decl::Bool)
+MAKE_EXTERN_SOCKET_DECLARATION(decl::Color)
+MAKE_EXTERN_SOCKET_DECLARATION(decl::String)
+MAKE_EXTERN_SOCKET_DECLARATION(decl::Geometry)
+
+#undef MAKE_EXTERN_SOCKET_DECLARATION
+} // namespace blender::nodes