use extern template in generated c++ files

in Comments
hi.
the files generated by slice2cpp
contain a lot of templates.
template instantiations slow down compilation.
a way to circumvent this problem is to use a explicit instantiation declaration
for the template instance in the header and add the explicit instantiation declaration
to the cpp (see here for more information).
i think it would be nice if slice2cpp
would use this feature (this can speed up the compilation of large code-bases).
since explicit instantiation declarations
are a c++11 feature, this probably should be enabled via a flag.
will you add such a flag to slice2cpp
in future?
best regards.
raphael
Tagged:
0
Comments
Hi Raphael,
We're always looking for ways to improve Ice, so thanks for the suggestion!
slice2cpp
does indeed rely on template instantiations, even more so with the new C++11 mapping.Did you update some of the generated .h and .cpp for your Slice files with explicit template instantiations to verify it this does indeed reduce your compilation time? Which Ice version and C++ compiler are you working with?
Explicit template instantiations have some downsides as well:
We actually used some explicit template instantiations in the generated code with Ice 3.6 (Windows only), but removed it for Ice 3.7 to reduce code size: https://github.com/zeroc-ice/ice/commit/c474b08073c63f6b1fcffe33a5d8172702c4d1f9
Best regards,
Bernard