Turning on cycle detection doesn't seem to affect the pause times for me. I
still get sub-millisecond pauses for Araq's Nim snippet.
This is the snippet I'm using:
```nim
# Compile and run with 'nim c -r -d:useRealtimeGC -d:release main.nim'
import strutils
#import times
include "$lib/system/timers"
const
windowSize = 200000
msgCount = 1000000
type
Msg = seq[byte]
Buffer = seq[Msg]
var worst: Nanos
proc mkMessage(n: int): Msg =
result = newSeq[byte](1024)
for i in 0 .. <result.len:
result[i] = byte(n)
proc pushMsg0(b: var Buffer, highID: int) =
# warmup:
let m = mkMessage(highID)
shallowCopy(b[highID mod windowSize], m)
proc pushMsg1(b: var Buffer, highID: int) =
# with benchmarking:
let start = getTicks()
let m = mkMessage(highID)
shallowCopy(b[highID mod windowSize], m)
let elapsed = getTicks() - start
if elapsed > worst:
worst = elapsed
proc main() =
# Don't use GC_disable() and GC_step(). Instead use GC_setMaxPause().
# GC_disableMarkAndSweep()
GC_setMaxPause(300)
var b = newSeq[Msg](windowSize)
# we need to warmup Nim's memory allocator so that not most
# of the time is spent in mmap()... Hopefully later versions of Nim
# will be smarter and allocate larger pieces from the OS:
for i in 0 .. <msgCount:
pushMsg0(b, i)
# now after warmup, we can measure things:
for i in 0 .. <msgCount:
pushMsg1(b, i)
echo("Worst push time: ", worst, " nano seconds")
when isMainModule:
main()
```