5 ms·
Go is fully native unlike VM-based languages. It stands half way between C/C++/Rust and Java/C#. Also, for performance critical sections, you can bypass the GC
by rahen 4y ago
Go is fully native unlike VM-based languages. It stands half way between C/C++/Rust and Java/C#.
Also, for performance critical sections, you can bypass the GC by importing "C" and "Unsafe" to get manual memory management and pointer arithmetic.
https://dgraph.io/blog/post/manual-memory-management-golang-jemalloc https://dgraph.io/blog/post/manual-memory-management-golang-...
- kaba0 4y agoYeah, Java, C# all can be compiled to native, that’s besides the point (java had gcj 20 years ago for that, not just graal nowadays). It is just bundling the runtime basically, nothing inherently different. FFI is available in basically every single language, C# was actually very explicitly made for this use case. And Java originally was literally made for embedded devices :D it is still running on every single SIM card and bank card, but there are many other solutions targeting embedded, for example microEJ.
- galangalalgol 4y agoMy experience and the benchmarks concur that go despite being native, is consistently noticably slower than c# and often slower than java. I think native vs vm isn't as relevant as I once thought it was. Then you have a dyanamic typed jit language like julia with performance leading the pack in performance, at least ong the gc languages. I would never have predicted that. Go is at the slower end of the non-interpreted gc languages when used idiomatically including all the vm languages. I would more say it lies between java and JavaScript. So between vm and interpreted. It shares that niche with swift and haskell.
- rahen 4y agoDid you try with a recent release of the Go compiler? Versions above 1.15 have seen significant performance optimizations, most notably better inlining.