Open
Description
Description
C/C++ backend takes +30 min to compile the below example in release mode. For JS backend it takes 0.5s to compile. It only takes so long in release mode. Debug mode takes 15s. Original issue reported in the nim-regex package.
type
Node = object
s: seq[int]
s1: seq[int]
s2: seq[int]
s3: seq[int]
s4: seq[int]
proc bigRegex(): seq[Node] =
for x in 0 .. 20_000:
result.add Node()
proc main() =
const br = bigRegex()
static: echo br[0]
echo br[0]
main()
Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-04-06
Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 8c9fde7
active boot switches: -d:release
Current Output
No response
Expected Output
No response
Possible Solution
No response
Additional Information
Replacing seq[int] by seq[int8] is also slow. Replacing seq[int8] by string, which should be a fairly similar data structure compiles fast-ish.