[nim-dev] Re: Nim GC Performance

  • From: Stefan_Salewski <mail@xxxxxxxxxxxx>
  • To: nim-dev@xxxxxxxxxxxxx
  • Date: Fri, 2 Dec 2016 16:47:13 +0000

Thanks for the link, sounds interesting, will read soon...

For your test code, I am not really sure what the purpose is. Nim's realtime GC 
is tunable, so you can get very short pause time with a tradeoff in throughput. 
See

http://nim-lang.org/docs/gc.html

You seems to test only only pause time for the default, which may be more tuned 
to throughput. (For my understanding, for most software pause times are not 
critical, or at least pause times of a few ms are fully OK, as for action 
games. For hardware control pauses may be critical, but if we do not allocate 
GC memory in critical parts, then the GC will not run in that critical part.) 
And when you are testing, you may test the boehm Gc as well.

I hope my understanding is not too wrong, I have newer spent time 
investigationg or understanding the GC.

For your code itself there is some room for improvement of course, for example

```nim
for i in items( result[] ):
        result[i] = byte( n )
```

should be writable as

```nim
for i in mitems( result[] ):
        i = byte( n )
```


Other related posts: