M
Markus Dehmann
I have a big class that contains code like this (the code is automatically
generated according to some configuration):
if(str == "name1"){
do;
something;
name1_specific;
}else if(str == "name2"){
do;
something;
name2_specific;
}else...
Now, since I have hundreds of these name1, name2, ... the code takes forever
to compile. Even worse, if only one name changes in the configuration, the
whole code gets re-generated and I have to wait on compilation very long.
Would some amount of separate compilation be a good idea?
// main.cpp
if(str == "name1"){
processName1();
}else if(str == "name2"){
processName2();
}else...
// name1.cpp
void processName1(){...}
// name2.cpp
void processName2(){...}
// ...
Now, if I have to modify name1.cpp, it won't affect the whole code anymore,
and compilation will be quick.
But does it affect runtime? Can these processName1()... functions be inlined
automatically? Or does the separate compilation make that impossible?
Thanks!
Markus
generated according to some configuration):
if(str == "name1"){
do;
something;
name1_specific;
}else if(str == "name2"){
do;
something;
name2_specific;
}else...
Now, since I have hundreds of these name1, name2, ... the code takes forever
to compile. Even worse, if only one name changes in the configuration, the
whole code gets re-generated and I have to wait on compilation very long.
Would some amount of separate compilation be a good idea?
// main.cpp
if(str == "name1"){
processName1();
}else if(str == "name2"){
processName2();
}else...
// name1.cpp
void processName1(){...}
// name2.cpp
void processName2(){...}
// ...
Now, if I have to modify name1.cpp, it won't affect the whole code anymore,
and compilation will be quick.
But does it affect runtime? Can these processName1()... functions be inlined
automatically? Or does the separate compilation make that impossible?
Thanks!
Markus