-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regression: compilation 5x slower (33s => 171s for nim_temp c testament) #16703
Comments
I think we should revert #16480; even if it didn't cause this regression (see also fixable issues in https://github.com/nim-lang/Nim/pull/16480/files#r556247845), there are better ways to get the same effect in a more generic way (see below) without having to add any symbol to Instead we can do as follows: template wrapStatic(s): untyped =
# needed pending https://github.com/nim-lang/RFCs/issues/276
(proc(): auto = s)()
# to add to sequtils
template foldlIt*(s, op, ret): untyped =
block:
var a {.inject.} = ret
for b {.inject.} in s:
a = op
a
import std/mimetypes
doAssert foldlIt(mimes3, (max(a[0], b[0].len), max(a[1], b[1].len)), (0,0)) == (24, 73)
static:
doAssert wrapStatic foldlIt(mimes3, (max(a[0], b[0].len), max(a[1], b[1].len)), (0,0)) == (24, 73) and perhaps even add a static:
doAssert maxIt(mimes3, (a[0].len, b[0].len) == (24, 73)
static:
# this is very fast (milliseconds)
for i in 0..<3:
echo wrapStatic(block:
let z = mimes3
foldlIt(z, (max(a[0], b[0].len), max(a[1], b[1].len)), (0,0)))
# this is very slow (4 seconds per iter)
for i in 0..<3:
echo wrapStatic foldlIt(mimes3, (max(a[0], b[0].len), max(a[1], b[1].len)), (0,0)) linkssee also #15528 which woud avoid this using ref types |
Please revert or improve it. |
=> #16711 |
|
#16480 causes some compilations to be 5x slower /cc @juancarlospaco
Example
./koch temp
t1: XDG_CONFIG_HOME= bin/nim_temp c testament/testament.nim
t2: XDG_CONFIG_HOME= nim c testament/testament.nim
right before #16480 (1d2e2b5)
t1: 33s
t2: 2.6s
right after:
t1: 171s
t2: 6.5s
Additional Information
still a problem on 61fd19c
--stackTraceMsgs +
-d:nimHasStacktraceMsgs
really helped when trying to figure out the culprit:when I ^C in a seemingly frozen compilation (t1) it showed:
which points to
mimetypes.nim(1934, 27)
, leading me to #16480EDIT: root cause is #16790
The text was updated successfully, but these errors were encountered: