4 ms·
No, assembly most of the time won’t be more efficient than langs like Go or Rust simply because people won’t be able to write efficient optimized code on pair w
by drogus 4y ago
No, assembly most of the time won’t be more efficient than langs like Go or Rust simply because people won’t be able to write efficient optimized code on pair with what modern languages can achieve and then it would be harder to actually architect your application correctly. Also add utilizing multiple cores to the mix.
When it comes to other languages I don’t think it’s that simple either. Yes, these benchmarks are not representative of what most people do at work, but I’ve seen orders of magnitude of difference between dynamic languages like Ruby or Python vs languages like Rust or Go when handling web traffic. Often web apps spend 50-70% of the time to handle request doing actual CPU work
- kaba0 4y agoLangs like Go? Go is a managed language with a compiler that barely does any optimizations (hence its compilation speed). I honestly get irrationally angry when it’s grouped with Rust,C,C++, etc.
- galangalalgol 4y agoAgreed, go should be next to java, C#, ocaml, julia, kotlin, swift etc. Solid multi-paradigm general purpose languages. Not systems/embedded/performance languages.
- rahen 4y agoGo 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.
- rahen 4y agoHave a look at the Tiny Go compiler, which does more optimizations: https://tinygo.org/docs/concepts/faq/what-is-tinygo/ https://tinygo.org/docs/concepts/faq/what-is-tinygo/ As mentioned you can also bypass the GC for performance critical sections.
- drogus 4y agoI know what is a difference between Go and Rust, but again - it's not only about the raw speed. I welcome you to try to code an async application in assembler...