Hello,
In my project, there are a lot of classes need to be exported. the cpp file is about 100,000 lines, takes 30 minutes to compile, and fails out of memory.
At present, I have split the CPP files.
The compiler is vs2019, and I tried the CLang compiler, but it took a long time.
So, how can i speed up compilation?
Thanks for your help !
I assume your mainly registering usertypes? This is non-performace critical code, so chunk your usertype defintions into seperate files and cache the object files.
Use CCache (linux, I assume windows has something similar) to speed up object compilation and llvm linker to speed up linking.
Compile times are long - that is the trade off for runtime speed.
My suggestions are along the same lines:
.new_enum<blah>( { { "name", value }, {"name", value } } ); to explicitly use theinitializer_list` form, which is vastly cheaper than the variadic functino formauto ut = state.new_usertype<my_class>("my_class", constructor ); and then ut["foo"] = &my_class::foo to prevent from using the long-form constructor that is a variadic template and thus takes a million years to compile.cpp files and not headers to avoid dragging bloat into every other header/compiled fileI have to do a formal compile-time investigation with aras-p's tool. I just have a lot of other things on my plate at the moment, too. 馃槄
Most helpful comment
My suggestions are along the same lines:
.new_enum<blah>( { { "name", value }, {"name", value } } ); to explicitly use theinitializer_list` form, which is vastly cheaper than the variadic functino formauto ut = state.new_usertype<my_class>("my_class", constructor );and thenut["foo"] = &my_class::footo prevent from using the long-form constructor that is a variadic template and thus takes a million years to compile.cppfiles and not headers to avoid dragging bloat into every other header/compiled fileI have to do a formal compile-time investigation with aras-p's tool. I just have a lot of other things on my plate at the moment, too. 馃槄