📜 ⬆️ ⬇️

About code optimization

Coder A friend of mine got a job at a very prestigious office for developing devices for communication walkie-talkies, mobile and so on. The office must be said very large and is in the TOP-50 in this industry.

And because of this size, there were a lot of bureaucratic moments in the office - coordination, meetings, and it took a lot of time to communicate. Programmers were mostly Indians there and they did their work very slowly, meditating, so to speak, during working hours.

But this is not the nature of our man! He quickly did his job and quickly got tired of kicking an ox, especially since all traffic was monitored - especially nowhere do you climb.

Then he decided to refactor and optimize some other code, of course asking for permission from his manager. Having received good, he took up the module noise cancellation.
')
Climbing he found a strange thing. The module itself was written a very long time ago and tables with a pre-generic value were used to calculate the sine wave, occupying such a valuable memory. Since modern controllers carried this function already in themselves (the same tables in the crystal itself).

And so he made a dump of the tables and checked them against the ones used. Of course, they matched one to one. Probably someone in the past was puzzled by this problem, then this task was done, but they lost the report in the bureaucratic machine.

Then the tables were discarded and replaced with the built-in capabilities of the microcontroller. About what and reported to the manager, showing that he made a place in the memory bank for the data.

It took a long time and complaints began to go to the company, saying that your devices often fail, do something.

The examination showed that the cause was the failure of the very microcontroller due to overheating. Guess what's the matter?

Of course, when using the built-in tables, the controller started to work faster and heated up accordingly faster. He did not think that the delay in accessing the memory bank was also used as an idle cycle for cooling. And the Hindu who wrote the code did not write anything about it in the comments.

The party was recalled and he was fired. And this is despite the fact that he argued that if idle cycles are inserted into his code, the microcontroller will not overheat. But no one listened to him.

Hence the moral:
Unforgettable ford - do not go into the water.
Code without comments is bad.
The bureaucratic machine is awful.
A guide that doesn't give a second chance is a nightmare.

Here is such an instructive story.

Source: https://habr.com/ru/post/83350/


All Articles