I noticed a potential easy way to reduce size of the generated code in case when usertype does not need any automagical detection.
I have some usertypes that are singletons or only expose a few methods. I used sol::no_constructor like this:
auto mySingleton = lua.new_usertype<MySingleton>("MySingleton", sol::no_constructor);
mySingleton["someFunc"] = &MySingleton::someFunc;
auto mySingletonInstance = MySingleton::Instance();
I did an experiment and I saved about 250 KB of object code per usertype (debug mode, MSVC x64) when registering them in this way:
I think it is worth mentioning in the documentation and providing something like no_automagic_enrollments in the headers so that everyone can benefit from smaller generated code size = faster compile time (even if it is optimized in release).
Firstly, thank you for this great library.
I noticed a potential easy way to reduce size of the generated code in case when usertype does not need any automagical detection. I have some usertypes that are singletons or only expose a few methods. I used
sol::no_constructor
like this:I did an experiment and I saved about 250 KB of object code per usertype (debug mode, MSVC x64) when registering them in this way:
I think it is worth mentioning in the documentation and providing something like
no_automagic_enrollments
in the headers so that everyone can benefit from smaller generated code size = faster compile time (even if it is optimized in release).