-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
heavy use of polymorphism results in long compiles #388
Comments
This is a bit of a tricky issue to optimize as it is difficult to get actionable information from the compiler about what takes time during compilation. The way polymorphic support currently works is based on the boost implementation and is designed to simplify the process for users, which may come at a cost for compilation time. polymorphic registration currently does not require knowledge of archives and types simultaneously - cereal handles the binding of types to available archives. In a nutshell, specific cereal archives create an overloaded definition of a special function ( When you go and register your polymorphic type, it tries to invoke this special function (remember it doesn't know about any archives), and must find the best possible overload of the function. Every archive you have included creates a type templated overload of this function. So when you register one type, it creates I'm not sure if there is a good way to optimize this using the current interface. However, it would likely be significantly faster if you were willing to individually tie types and archives together. This would remove the entire overload process from registration, meaning you'd do something like: CEREAL_REGISTER_TYPE_WITH_ARCHIVE(myType, cereal::BinaryInputArchive, cereal::BinaryOutputArchive) or something similar. |
I am very much willing, I'll have to give that a shot! |
I just want to note that this feature is not actually in cereal right now, but could be easily added. |
aw man you had me so excited |
Is there any news on this topic? My compilation time is huge and uses a lot of memory too. |
@AzothAmmo Is this feature still plan for 1.2.3? |
via metaprogramming, a project I'm working on has a very large number of cereal message types registered (~700) and we've started to notice that each call to CEREAL_REGISTER_TYPE incurs a heavy compile time cost, anywhere from 0.5 - 0.8s per invocation. Are you aware of this? Is there any way to shave that time down?
The text was updated successfully, but these errors were encountered: