Comment

Comment by robomartin

Objective-C is interesting. The problem I had back when we were using it was lack of performance. For us, in many cases, refactoring code down to C easily improved performance over 400 times. Code that struggled to deliver output in a usable time scale quickly became better than real time.

Today, in computing, we are using far more energy than necessary because of the proliferation of inefficient languages in server, desktop and mobile codebases. I would guess we could achieve a non-trivial improvement in carbon footprint if computing were to have the same kinds of energy efficiency requirements we impose on appliances and vehicles.

This study [0], published in 2017, evaluated the time, energy and memory efficiencies of some thirty languages. Sadly they did not include Objective-C. Swift did make the list.

Table 4 shows the normalized results. C was most energy and time efficient and very close (third) in memory efficiency. Swift consumed nearly three times more energy, four times slower and nearly three times the memory. Python requires 76 times more energy, 72 times more time and three times more memory.

Clearly there is a cost to choosing a language along these vectors. Given the ubiquity of computing in human life today, I am sometimes surprised that we have not become far more critical about permanently baking-in terribly bad energy inefficiency into systems and products. Developing energy-efficient software using languages like C, C++ and Rust isn't really that difficult.

[0] https://greenlab.di.uminho.pt/wp-content/uploads/2017/10/sle...

parent robomartin 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton