loading...

Discussion on: The way programmers think about performance is too narrow

Collapse
jorgecc profile image
Jorge Castro

The main problem with performance is, once the performance is lost, sometimes it's impossible to get it back. We could add more machine (and toss more money in the process), it is always possible until at some level. if we touch the peak of a machine, then we need to add more machines, and it means to change the code and we need to add more moving parts to the system (moving parts that each one could break anything).

For example, let's say the next pseudo-code:

products=query("select * from products");
show(products);

This code could work fine with a small set of data, 10 products = yes, 100 = yes, 1000 = well, yes too. But what about 20k?. If we try to show on the screen (web), then it could crash or put in slow mode the browser.

Now, what about 1 million of products?. It will slow the whole system, the database, and the system.

Then

products=query("select * from products").paging("1 to 20");
show(products);

These changes do a lot of different. If the pagination is done in the database, then the system could escalate to 1 million of products in a snap, without adding new server or infrastructure, and it is just a single line of code. Sometimes, this simple fix requires to rebuild the core of the system (i.e. practically most of the code) and it shows that we failed to evaluate the system.

If my business grows, will I need to run this 100, 50,000, 5 million times a day?

It is exactly the main point of software architecture. It must evaluate the size and impact BEFORE we start coding. So, we must evaluate a maximum size until we hit the ceiling and we need to invest in more machine and new software or build a new version.

For example, SAP.
One of my customers has SAP and a legacy ERP.

He runs SAP in a high-performance server (servers) and SAP is dog-slow. Internal customers complain a lot about it.

While he has a legacy ERP running in a modest configuration. It's ugly at best but it's blazing fast. Some of the internal customers have even complained that they want to turn back to the old system.

Collapse
sunrick profile image
Rickard Sundén Author

Hey Jorge, thanks for sharing! Totally agree that it is a judgement call you'll have to make before coding!