The Cost of efficiency
This post belongs to a small series on the dangers of blindly pursuing efficiency in software development. This is the first, main post. Links to the other posts in the series can be found below.
In the business world, there’s a well-known saying dubbed “The Seven Most Expensive Words”: “We’ve always done it this way.” I think software engineering has its own version of that sentence. It’s an argument I hear all too often.
The four most perilous words in software engineering: “That is not efficient!”
Both managers and software engineers reach for this phrase. Managers use it out of a desire to streamline processes and maximize productivity. Engineers use it as a reason to dislike a particular solution or way of working. For engineers, who continually strive to optimize their software, processes and algorithms, this argument carries real weight. Given how much software engineering prizes efficiency, it often lands as a conversation-stopper, as if it were irrefutable.
I’ve become wary of the “efficiency” argument. Efficiency is often treated as the holy grail, when in reality there’s more to consider. In this series, I want to explore why seemingly inefficient approaches sometimes make sense. Efficiency comes with trade-offs, and it occurs in a context for a given scope.
The drive for efficiency
Efficiency, simply put, means doing things right without errors or unnecessary waste of resources like materials, energy, time, or money. It’s about performing tasks effectively and successfully. Now who could argue against that?
Ever since the industrial age, the pursuit of efficiency has been relentless. That pursuit shows up in a few recurring objectives:
- Maximum Resource Utilization: ensuring all resources operate at maximum capacity.
- Division of Labor: assigning specialized resources with the highest output to specific tasks.
- First-Time Right: striving to get it right on the first attempt and avoid rework.
Challenging any of these goals often prompts the same response: “That is not efficient!” It sounds conclusive, but it isn’t — it ignores a lot of other factors.
Efficiency trade-offs
Efficiency is, on its own, a good thing, even a goal worth pursuing. But it has trade-offs, and we need to be aware of them so a conversation doesn’t end just because someone invokes efficiency. There’s more to life than maximum efficiency. In fact, there probably wouldn’t be any life at all if everything were efficient.
Mother Nature
Let’s leave IT for a minute and look at Mother Nature.
In nature, not everything is efficient. Look at how cells develop, in plants as in animals: it happens in a non-deterministic way. What a given cell becomes isn’t fixed from the start — cells can develop along a wide spectrum. It would be more efficient in the short term if each cell were assigned a function from the outset, but in the long term that comes at a cost: it would hinder the organism’s ability to adapt to external change. By being suboptimal, inefficient at the small scale (cells), nature becomes resilient at the larger scale (organisms).
Cells are optimized for adaptableness, not efficiency
An ant colony is another example. There’s built-in redundancy in tasks and roles, of course, but even the route a single ant takes isn’t efficient. For the colony as a whole, though, that inefficiency pays off as resiliency: multiple routes and options for finding food.
Inefficiency in the small yields resiliency in the large.
A more visual example is plants1. Green is the color that reigns over the plant kingdom — but why green, and not black? Plants’ photosynthetic cells, which regulate the energy flow during photosynthesis, absorb almost all the photons in the red and blue regions of the light spectrum, but only about 90% of the green ones. Absorb more, and they’d look black. So what’s the trade-off for staying green instead of going all-in on absorption?
Leafs opt for stability over efficiency
Not capturing all the green light serves a purpose. Incoming light constantly changes, so a cell that absorbed everything would see its internal energy flow constantly shift too. A stable energy flow matters more to the cell than maximally efficient absorption — too few electrons causes an energy shortfall, too many causes overcharging. So the cells regulate their light absorption and “spit out” green light instead. Evolution cares less about being efficient than about being stable.
“To be resilient against external changes, prioritize stability and adaptability over efficiency”
Computer science
Computer science has plenty of examples where efficiency was sacrificed to gain resiliency.
TCP/IP, the protocol suite that regulates how packets travel across a network, is definitely not efficient — but it is resilient. It needs to be, given how much can go wrong: data gets corrupted, packets get lost, nodes fail constantly as the network changes. It was designed this way on purpose: efficiency in the small was sacrificed for resiliency at scale. Stability and adaptability were prioritized over efficiency.
TCP/IP designed for resiliency
Algorithm design shows the same trade-off. People often choose a suboptimal heuristic over an optimal exact algorithm, because many real-world problems are too complex for the ideal, most efficient solution to be worth pursuing. Instead, they sacrifice efficiency, introduce some randomness, and settle for a “good enough” solution — the computational and time cost of the optimal one is simply too high. Past a certain point, chasing the most efficient solution hits diminishing returns, which makes the less efficient solution the more efficient choice overall.
It can be more efficient to go for the less efficient option
The choice
From these examples, a few conclusions already emerge:
- Optimizing for local efficiency can hurt resiliency at the larger scale.
- Choosing the most efficient solution may not be worth the effort — a faster, good-enough solution can be more valuable.
- Efficiency is usually achieved in a well-controlled environment. Depending on the type of environment, resiliency may matter more.
- If the environment changes frequently, the effort spent being efficient can be waste in itself.
Conclusion
The main thing I hope to pass on with this post can be summarized as follows:
The cost of efficiency is resiliency.
Efficiency is usually achieved within a well-controlled environment, for a given scope — so make sure efficiency is actually what you need, and be clear about the scope you need it in. Short-term efficiency can cost resiliency over the longer term, at a larger scope, which often ends up more costly and more wasteful than the efficiency gained. So don’t give in too quickly to the “that’s not efficient” argument.
Change is the one constant in software engineering, which is exactly why the efficiency argument is so dangerous here. It’s often better to prioritize resiliency — to sacrifice short-term, local efficiency for a more durable, resilient solution in the long run. In fact, a lot of good software practices do exactly that: they look inefficient at first glance, but prove very valuable once you take the whole context into account. The rest of this series looks at where that trade-off shows up in practice.
Links
The blog posts in this series: