|
|
|
|
|
by naasking
778 days ago
|
|
> TBH, once you have halfway-good libraries for dealing with `char *` strings as-is, dynamic arrays and hashmaps, you are not going to be much slowed-down using C than using a higher-level language. That can't possibly be true. Not having to even think about object lifecycles and ownership because all memory is GC'd saves a lot of time all by itself, not even getting into debugging issues when you get it wrong. |
|
I think perhaps the context may make it clearer: it was about simplicity.
>>> the simplicity and immediacy of results opened my eyes to how C can feel as productive as higher level languages with robust standard libs.
So, sure, no one is saying that you'll be faster in C, but with such a small cognitive footprint, you can be faster than you'd think.
When programming in C, I don't spend much time thinking about the language, I think about the problem more than the language. I don't think about complex relationships between language features; about what might happen if I use a reference in a lambda. I don't need to remember what the `this` keyword refers to depending on how the function was created. I don't need to puzzle my way out of a painted corner due to colored functions.
It's the simplicity that I was responding to. You go faster than you would expect.
As far as object lifecycles go, there's a small number of idiomatic ways to mitigate the problems. Not foolproof, but with such a simple language, whatever valgrind reports can be quickly fixed.
Regarding ownership: I'm not really aware of how GC languages, by way of being GC, helps there. I'm pretty certain it doesn't. If you pass an object to a method in Java, C#, whatever, and that method starts a new thread with it, you're still going to be boned if the callee starts modifying it at the same time.
Whatever ownership issues you have in C, you'll have in most other GC languages as well.