- cross-posted to:
- rust
- programming
benchmarksgame-team.pages.debian.net
- cross-posted to:
- rust
- programming
You must log in or # to comment.
One is not uniformly faster than the other. They both give low-level control to memory, so they’re in the same class of speed. Some factors that might be relevant:
- Most OS’s have a libc - compiled C libraries that C programs are linked against, though you can statically compile C just like rust
- C has been around for a while, and with it’s relevance, has been optimized by people all over the world for decades
- Since we’re mentioning GCC specifically, GCC is probably one of the most optimized compilers for C / C++
- Even within “gcc C,” there are multiple libc’s to run on. Most popular in unix-like OS’s is glibc (GNU libc), though musl-libc, uclibc, and others exist. Linking against these libc’s might be even faster.
- Compiled rust files tend to be big, since it’s not linking against a “librust”
In summary, they’re simply in the same class of speed, but C has the advantage of being older.