Closed
Description
The generated cpp2regex.h
file is ~170 KB and so I wondered what the impact on compile times are.
With clang 18 on ubuntu, I tested with and without including cpp2regex.h
from inside cpp2util.h
when compiling an empty main
function lowered from Cpp2:
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
//=== Cpp2 type definitions and function declarations ===========================
[[nodiscard]] auto main() -> int;
//=== Cpp2 function definitions =================================================
[[nodiscard]] auto main() -> int{
return 0;
}
With cpp2regex.h
$ time clang++ -std=c++23 -stdlib=libc++ -fexperimental-library -Wall -Wextra -Wconversion source.cpp
real 0m2.628s
user 0m1.953s
sys 0m0.098s
Without cpp2regex.h
$ time clang++ -std=c++23 -stdlib=libc++ -fexperimental-library -Wall -Wextra -Wconversion source.cpp
real 0m1.138s
user 0m1.074s
sys 0m0.045s
I repeated the test a few times and the results were relatively stable. The real (wall clock) time is approx 2X more when bringing in cpp2regex.h
, so I wondered if cppfront can detect whether it's needed and then conditionally include it?