5 ms·
It's a multidimensional problem. 1.) Rush to build. Backpressure and deadlines lead to "lets just spin it up thje easier way" 2.) We said "premature optimisat
by thecupisblue 5y ago
It's a multidimensional problem.
1.) Rush to build. Backpressure and deadlines lead to "lets just spin it up thje easier way"
2.) We said "premature optimisation is the root of all evil".
This ended up in devs not thinking about performance at all because "hurr durr" premature optimisation. I've witnessed this mentality causing huge problems in performance due to simplest decisions that would be normal in other circumstances, but snowball into a huge perf issue. Exactly as the title says, best practices can slow your application down, especially when used out of context. Some include "I'll serialise this into json and deserialise it again 5 lines later", "I'll use a regex to parse this simple string", "I'll nest 3 map calls here on a list", "I'll find it later in the list again".
3.) People forgot/never learned what the stack is.
Honestly, when people say software was harder to write back in the day, I'm never sure if I agree with it or not. One one hand, yes, we had less tools and materials at our disposal. But at least the thinking through it was easier, since with the small set of tools you have, you could go up and down the stack in your head and know that if you do X, Y and Z, that's what would happen. Nowadays, we have so many tools and layers that it takes a huge amount of knowledge, time and mental energy to reason about your whole stack. We have people specialised in tiny subsets of the stack, so getting performance squeezed out at overall stack level requires people who understand more of the stack, which is getting rarer and rarer by day.
4.) We have lost touch with the power of hardware.
Consider that most of senior devs are from an age where hardware was way less powerful and in the last 20 years, the power and availability of hardware has increased so much that it is hard for us humans to grasp - especially since the machines we use on a day-to-day basis still work nearly the same. Yet, we hear all these stories about hundreds of lambdas serving thousands of requests, so most of devs don't even have an idea of how much a single machine can serve but picked up "oh it's cloud scale" mentality. Combine this with "fear of low resources" and the ease of spinning up a new machine when resources are low and the answer is obvious - spin it up.
5.) We still think linearly.
People don't think exponentially most of the time. We don't assume that line of code will net us 30x speed improvements. We don't assume this loop will go quadratic. We tend to ignore tiny accumulations until it's too late. And when met with the performance wall, we discard optimisation because its hard to believe that we can easily 10x or 20x the speed since in our heads "it's just unnatural". You can't change tires on a car and have it go 2000mph suddenly. But with code you can, that's the problem.
- marginalia_nu 5y ago> 4.) We have lost touch with the power of hardware. I think this is actually a key to solving all of these problems. If you target (at least during testing) low power bare-metal hardware, a raspberry pi 2 or whatever, then performance problems become immediately obvious. If you put a web server on a pi, it should be able to serve dozens, maybe even hundreds of requests per second. If it can't, then odds are you are doing something wrong.
- kaba0 5y agoI always like to add the whole quote: “We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.” I see it way too often that someone wastes way too much time with optimizing a code that is run only once with like 3 items. So I still think the measure and optimize later is still true. With today abstractions noone can really tell what will be a bottleneck — even just the CPU has an insane amount of complexity going on with reordering and branch-predictions. Even the seemingly faster code can be an order of magnitude slower surprisingly.
- giantrobot 5y ago> So I still think the measure and optimize later is still true. This is a huge issue because measurement is difficult. There's also a lot of developers that are bad at measuring and interpreting the results when they do measure. So you end up with people writing unoptimized or just plain slow code with // TODO: Add measurements. Then complicate the whole thing by simply accepting bad performance and scaling horizontally and paying through the nose.
- kaba0 5y agoWell, I wouldn’t trust their ability to optimize code either if they can’t even properly benchmark something so there is that.
- jiggawatts 5y ago> We still think linearly. A case in point is that people assume that Omicron is "not dangerous" because it puts 5x fewer people in hospital compared to Delta. Unfortunately, it spreads 2x fast. But that "2x" is an exponential speed up, and the reduced mortality is a linear one.