4 ms·
I see this comment pop back every once in a while. I'm sure your arguments have value; yet, for some reason, C is always among the winners in almost every bench
by joelthelion 12y ago
I see this comment pop back every once in a while. I'm sure your arguments have value; yet, for some reason, C is always among the winners in almost every benchmark I've ever seen, and also in my personal experience (except for numerical stuff where fortran might be a little faster).
Why is that so? Do more modern languages need another twenty years before they can compete with C (and eventually beat it performance-wise) ?
- Dewie 12y agoI don't think that the OP is necessarily saying that there are ~mainstream languages that are faster than C; just that C is far from optimal when it comes to speed and how much it can be optimized. "Not that fast" doesn't necessarily mean that it isn't the fastest we have got.
- pjmlp 12y agoBecause that is where compiler vendors spent the last 30 years doing compiler backend optimization. When I started coding in the mid-80's C compilers were dog slow and no better than the alternatives (Pascal, PL/I, Modula-2, Cedar, ...). In fact, game developers would talk about high level languages the same way they talk about current modern languages vs C/C++, and use nothing else other than Assembly. However with UNIX spreading into the enterprise and bringing C along, it meant compiler vendors focused on optimizing for the language they were getting money for. The main issue when people compare languages, is that they forget although the design drives the implementation, not all implementations are alike.
- agumonkey 12y agoBecause C allows for some straightforward mechanical sympathy. As Stutter said, C makes you care about memory layout and cache hierarchy a little, so you win by using all the hardware niceties (prefetchers). I'd say C has a good pareto index. You can go faster but it will require far? more work (to either write or learn a different platform/paradigm). ps: for instance in some cases, jitted code will go faster than C, some Jitted kernels (never tested personally) allowed for a good 30% performance increase.