compile-time-regular-expressions icon indicating copy to clipboard operation
compile-time-regular-expressions copied to clipboard

Infinite compile time in Release mode with MSVC

Open jeanga opened this issue 4 years ago • 4 comments

Not a CTRE issue but a compiler one that may be interesting for you to follow: https://developercommunity.visualstudio.com/content/problem/1107230/msvc-version-1670-preview-31-release-build-never-completes-ran-for-12-hours-debug-build-takes-seconds.html

TLDR: With a long regex, Release build with latest MSVC and CTRE 2.8.3 never completes.

jeanga avatar Jul 09 '20 07:07 jeanga

Ran into this trying to deal with the bad optional pattern https://github.com/hanickadot/compile-time-regular-expressions/issues/109

When optional was separate struct I removed forceinline and that pretty much reduced the compile time to nothing, something's definitely a bit off w/ the MSVC compiler though.

Andersama avatar Nov 09 '20 13:11 Andersama

I guess this is a duplicate of #91, but unfortunately links in that issue are now wrong - azure removed the old logs.

The regex that I had tried was this:

R"(^([^\t\n\r]++)\t([^\t\n\r]++)\t.*?" "language:([^\t\n\r]++).*?$)";

bstaletic avatar Nov 14 '20 22:11 bstaletic

I'm working on a big refactoring of loops, which will remove a long standing bug and will work differently, hopefully better :)

hanickadot avatar Nov 14 '20 22:11 hanickadot

I realize this is a known issue, and I read some of the previous posts. I guess it has something to do with forced_inline. I am just posting that I also experienced this issue. I saw that disabling the inline optimizations should help. So I'm adding this to my CMakeLists.txt for the app that uses ctre. This works fine in my case. It's just a little app.

if (MSVC)
    target_compile_options(${PROJECT_NAME}_tile_csv_to_map
            PRIVATE /Ob0)
endif ()

https://docs.microsoft.com/en-us/cpp/build/reference/ob-inline-function-expansion?view=msvc-160

Here's the regular expressions I'm using.

(\.([1-3])\.[cC][sS][vV])
(\d+),"?0x([0-9A-F]+)"?,(\d+),(\d+),"?([A-Za-z ]+)"?,(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(-?\d+),(-?\d+),(\d+)

Sebanisu avatar Jun 24 '21 00:06 Sebanisu

This issue is solved by more recent MSVC versions (17.3+)

jeanga avatar Oct 06 '22 21:10 jeanga