I didn't mean efficiency of parsing generally, I was just referring to what you said about build2-style being slower than using the scanners. I'm struggling to see what could make the scanners all that much faster than a full preprocess. And if they're not, then it means we've sacrificed being able to do things like
for very little reason. I used to have something like this in place for one of my libraries that allowed me to develop it while being able to toggle back and forth between modules/headers via build configuration (and without having to lump everything into one module which kills iterative builds). I had to give that up once clang started to more strictly implement the module directive preprocessing rules.
The scanner produces the source file dependency output directly, the preprocessing and scanning are a single process without any intermediate artifacts. build2-style preprocesses, writes the entire preprocessed source file to disk, then scans that again. It's just more steps and expensive file IO.
View all comments
Show parent comment
2
u/kamrann_ Mar 11 '26
I didn't mean efficiency of parsing generally, I was just referring to what you said about build2-style being slower than using the scanners. I'm struggling to see what could make the scanners all that much faster than a full preprocess. And if they're not, then it means we've sacrificed being able to do things like
#if MYLIB_ENABLE_MODULES
export module mylib;
#endif
for very little reason. I used to have something like this in place for one of my libraries that allowed me to develop it while being able to toggle back and forth between modules/headers via build configuration (and without having to lump everything into one module which kills iterative builds). I had to give that up once clang started to more strictly implement the module directive preprocessing rules.