4 ms·
But I think other memory safe languages don't have C++-like performance, right?
by kangalioo 4y ago
But I think other memory safe languages don't have C++-like performance, right?
- goodpoint 4y agoThere's been many, for example Ada/SPARK, D, Nim, Java, Kotlin, Swift.
- kllrnohj 4y agoI can't speak to the others, but Java & Kotlin do not at all have C++-like performance, especially not in anything beyond a toy level benchmark. And even in those toy level benchmarks (like https://benchmarksgame-team.pages.debian.net/benchmarksgame/box-plot-summary-charts.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... ), there's a clear divide between C/C++/Rust & everything else.
- goodpoint 4y agoThe claim that performance are comparable only on "toy benchmarks" is false. Additionally, most of such simple benchmarks are not representative for real-life workload, and anyways the initial point was about safety. Anyhow the whole HN conversation is now a trainwreck where any dissenting opinion is downvoted so there's no point to continue.
- pkolaczk 4y agoToy benchmarks give JVM an edge because JVM optimizes code locally. Small amount of code in a benchmark means a majority of it can be inlined and then the JVM can actually remove a lot of Java-specific overhead like heap allocations, at least theoretically (I've seen it utterly fail in some cases even on toy benchmarks, though). However in bigger programs JVM has no way to optimize the inherent overheads stemming from the design of the Java language. Rust and C++ don't have those overheads from the start, and then on top of that their compilers can do whole program optimization because they have plenty of time and resources to do so.
- kllrnohj 4y agoToy benchmarks are also a lot easier to write in "C-like" Java instead of "normal" Java. That is, avoiding boxing, interfaces, etc..
- nneonneo 4y ago- Ada: good example, has substantial uses in certain areas. However, certain things are quite difficult, e.g. compile-time checked pointers (a la Rust's borrow-checked references). - D, Nim: neither provide strong memory safety guarantees. D has a safe subset, but it's not default (see https://news.ycombinator.com/item?id=12391720 https://news.ycombinator.com/item?id=12391720). Nim allows you to turn checks off at runtime. Both Nim and D generally use a GC. - Java/Kotlin are not low-level: requires GC, and not often used for low-level systems programming. Great languages, but different niche.
- micronian2 4y agoThe fact that you originally didn’t know that Ada is heavily used in embedded clearly shows you don’t know it. Even though you edited your reply, any reader should seriously doubt your claim that “certain things are quite difficult” in Ada. Do you know that in Ada, you don’t have to use pointers or heap memory nearly as much as other languages such as C and C++? You can even write programs that don’t even use any. That avoids a whole class of issues. One of the extra advantages with Ada is that you can decide to utilize the SPARK variant and do formal proofs on software components that are more critical. I invite you and and others to watch the presentation by Altrans where they talk about 30+ years of SPARK usage to help develop ultra low defect software: https://youtu.be/VKPmBWTxW6M https://youtu.be/VKPmBWTxW6M
- thesuperbigfrog 4y ago>> Ada: good example, but not usually used for low-level systems programming. Has substantial uses in certain areas. Ada is primarily used for low-level systems programming and embedded systems: https://learn.adacore.com/courses/intro-to-ada/chapters/introduction.html#ada-today https://learn.adacore.com/courses/intro-to-ada/chapters/intr... Substantial portions of the Ada standard deal with systems programming and low-level representation on hardware: http://www.ada-auth.org/standards/22rm/html/RM-C.html http://www.ada-auth.org/standards/22rm/html/RM-C.html http://www.ada-auth.org/standards/22rm/html/RM-13-1.html http://www.ada-auth.org/standards/22rm/html/RM-13-1.html
- nneonneo 4y ago