# HG changeset patch # User sam # Date 1724495598 -25200 # Node ID 1d77dfecdabec6bea403f43defe6a9fe82987857 # Parent 164276e8697fd70bf597a9801568b5b1cd60bef1 did: disable side effects for time logging diff -r 164276e8697f -r 1d77dfecdabe semicongine/core/utils.nim --- a/semicongine/core/utils.nim Sat Aug 24 14:10:21 2024 +0700 +++ b/semicongine/core/utils.nim Sat Aug 24 17:33:18 2024 +0700 @@ -42,17 +42,21 @@ template TimeAndLog*(body: untyped): untyped = when ENABLE_TIMELOG: - let t0 = getMonoTime() - body - echo (getMonoTime() - t0).inNanoseconds.float / 1_000_000 + {.cast(noSideEffect).}: + let t0 = getMonoTime() + body + {.cast(noSideEffect).}: + debugecho (getMonoTime() - t0).inNanoseconds.float / 1_000_000 else: body template TimeAndLog*(name: string, body: untyped): untyped = when ENABLE_TIMELOG: - let t0 = getMonoTime() - body - echo name, ": ", (getMonoTime() - t0).inNanoseconds.float / 1_000_000, "ms" + {.cast(noSideEffect).}: + let t0 = getMonoTime() + body + {.cast(noSideEffect).}: + debugecho name, ": ", (getMonoTime() - t0).inNanoseconds.float / 1_000_000, "ms" else: body