News for hackers. Stuff that matters.
Re:Nim vs Rust Benchmarks by cogman10 on Monday February 07, 2022 @07:54AM (#30244138)
C is an easy intermediary, C is a bad intermediary.

The issue with targeting C is you ended up losing a lot of information about intent. Compilers looking at C have to put a lot of trust that what the programmer wrote was intentional (and thus, unoptimizable).

Rust and C both end up faster than Nim because they are talking directly to the compiler.

IDK enough about Nim to say if it could hit Rust/C speeds if it targeted the LLVM instead, but it would be a lot faster than it currently is targeting C.

Re:Nim vs Rust Benchmarks by masklinn on Monday February 07, 2022 @08:38AM (#30244624)
> C is an easy intermediary, C is a bad intermediary.

> The issue with targeting C is you ended up losing a lot of information about intent. Compilers looking at C have to put a lot of trust that what the programmer wrote was intentional (and thus, unoptimizable).

The same issue exists in C-sourced compiler backends, which is both GCC and LLVM. It’s not exactly a secret that anything which is not strongly exercised by standard C(++) codebases tends to be rather broken for any non-trivial use and takes years to fix (restrict/noalias being the poster child for this, at least in the context of Rust, I think it hasn’t gotten re-disabled yet so it might make a year).

Re:Nim vs Rust Benchmarks by cogman10 on Monday February 07, 2022 @11:19AM (#30246885)
I think that has less to do with LLVM/GCC being C(++) implementations and more to do with the fact that the primary language compiled by these compilers is C and C++. Other languages that target these compilers aren't used nearly to the same level (maybe swift now?).

The JVM, for example, doesn't see the same issue so much with non-Java languages. Mainly because (IMO) it's been hosting non-java languages for several years now.