Closed ChemiCalChems closed 8 months ago
I'm amazed that things compile quicker, even though more is happening at compile time.
@liuzicheng1987 std::regex
is notorious for being incredibly slow both at compile-time and at run-time. Hana showed some data regarding this in her CTRE talks. Quite astounding it's so bad.
As discussed in #37, it would be beneficial to move over to compile-time regex. Hanickadot's CTRE allows for this. Here is the (hopefully) much awaited PR.
On my machine, tests now compile quicker and into smaller binaries. They also run marginally quicker, though I didn't test this with a big enough sample size to conclude anything other than anecdotally quicker runs.
With this we reap some of the benefits of compile-time regex, but it would be cool to move forward and be able to do compile-time parsing too. For that, we are going to need to make a lot of our internals to be constexpr (I think most of them can be constexpr as it stands). There is no reason not to do this, and would allow nice stuff to happen.
Once this PR is merged, #37 can be closed.