Long compile times for clang17 on macOS for 300 loc C++ file

I recently built clang17 from source on macOS 10.15
I did set CMAKE_BUILD_TYPE=Release

But the compilation time for C++ is very long. compared to apple-clang and llvm-clang-14
the times are way off for llvm-clang-17
timings are listed here:

the sky.cpp file is from scratchpixel