3 ms·
Concurrency is achieved via async await. For parallelism each thread has its own GC so that makes things a lot safer, but sadly less efficient if your algorithm
by dom96 8y ago
Concurrency is achieved via async await. For parallelism each thread has its own GC so that makes things a lot safer, but sadly less efficient if your algorithm wants to share data between threads a lot (you can copy data between threads). You can also allocate shared memory but that's considered unsafe, this will hopefully be improved in the future.
As for how well this all works, well, I recently implemented a high performance parallel HTTP server [1]. It's currently hosting the Nim Forum[2] and has been doing so for the past few months. Also it's proving very performant[3].
1 - https://github.com/dom96/httpbeast https://github.com/dom96/httpbeast
2 - http://forum.nim-lang.org/ http://forum.nim-lang.org/
3 - https://www.techempower.com/benchmarks/#section=test&runid=b9d29130-bd5a-4c2a-829d-352613d03cd2&hw=ph&test=plaintext https://www.techempower.com/benchmarks/#section=test&runid=b...
- wuschel 8y agoMany thanks for the detailed answer & ref.links.
- michaelsbradley 8y agoIt would be amazing if Pony Lang's[+] concurrency model could be realized in Nim, or if Nim could be extended as a language to optionally and cleanly support it. That's easier said than done, of course, since Pony's concurrency model is deeply wedded to its type system ("reference capabilities"). [+] https://www.ponylang.org/discover/#what-makes-pony-different https://www.ponylang.org/discover/#what-makes-pony-different