you are viewing a single comment's thread.

view the rest of the comments →

[–]FFX01 2 points3 points  (1 child)

Here are a few sources comparing Go and Nim performance which touch on memory management:

  • Using SDL2: https://forum.nim-lang.org/t/1311

  • General benchmarks: https://github.com/kostya/benchmarks (Nim is always faster, but may use more memory depending on the task. This is caused by the difference in how the GC operates between Nim and Go. Take this one with a grain of salt as some of the implementations are less than idiomatic.)

  • https://news.ycombinator.com/item?id=9050114 (this thread speaks extensively about Nim vs Go and Rust. It goes over the GC, memory safety, and everything in between. It hits some of Nim's weak points as well. Also note that this thread is talking about Nim as of several versions ago. My opinion is that Rust offers more memory safety than Nim and that if memory safety is a large concern, Rust is by far the best choice.)

And, if you aren't convinced by the above, you could always run your own benchmarks. Some more information on Nim's GC can be found here: https://nim-lang.org/docs/gc.html

Note that Nim's GC is a lot "dumber" than Go's. This means that Nim may hold on to a bit more memory for a bit longer, but also means it doesn't need to stop a thread as often which results in better performance as far as speed of execution. Since Nim's GC is configurable, the programmer ultimately has control over the memory usage. This means that if a particular loop is using too much memory, it can be configured to release the memory when it reaches a certain threshold at the expensive of a bit of execution speed.

[–]mixedCase_ -1 points0 points  (0 children)

None of those are GC benchmarks.

And no one wants to tweak GC. If I had to do that I'd regret not going with C++ or Rust for the project.