cross-posted from: https://lemmy.world/post/31184706

C is one of the top languages in terms of speed, memory and energy

https://www.threads.com/@engineerscodex/post/C9_R-uhvGbv?hl=en

you are viewing a single comment's thread
view the rest of the comments
[–] 55 points 1 year ago (14 children)

Machine energy, definitely not programmer energy ;)

  • source
  • hideshow 14 child comments
  • [–] 27 points 1 year ago (13 children)

    I would argue that because C is so hard to program in, even the claim to machine efficiency is arguable. Yes, if you have infinite time for implementation, then C is among the most efficient, but then the same applies to C++, Rust and Zig too, because with infinite time any artificial hurdle can be cleared by the programmer.

    In practice however, programmers have limited time. That means they need to use the tools of the language to save themselves time. Languages with higher levels of abstraction make it easier, not harder, to reach high performance, assuming the abstractions don’t provide too much overhead. C++, Rust and Zig all apply in this domain.

    An example is the situation where you need a hash map or B-Tree map to implement efficient lookups. The languages with higher abstraction give you reusable, high performance options. The C programmer will need to either roll his own, which may not be an option if time Is limited, or choose a lower-performance alternative.

  • source
  • parent
  • hideshow 13 child comments
  • [+] 3 points 1 year ago (6 children)
  • [–] 6 points 1 year ago (2 children)

    Well, let’s be real: many C programs don’t want to rely on Glib, and licensing (as the other reply mentioned) is only one reason. Glib is not exactly known for high performance, and is significantly slower than the alternatives supported by the other languages I mentioned.

  • source
  • parent
  • hideshow 2 child comments
  • load more comments (3 replies)
  • load more comments (9 replies)
  • load more comments (9 replies)