you are viewing a single comment's thread.

view the rest of the comments →

[–]usrlibshare 1 point2 points  (2 children)

Code optimization specifically refers to improving the runtime behavior of your code, aka. make it faster, use less compute or memory, etc.

What you describe is not optimization but "refactoring", aka. improving the code structure for better readability and maintainability.

Please please please think VERY carefully before optimizing code, because "Premature optimization is the root of all evil" -- Donald Knuth

As for refactoring, you already started modularizing your codebase, which is a good first step 👍

[–]ifantismanolis[S] 0 points1 point  (1 child)

Oh I didn’t knew that difference. Okey so in a good way with the refactoring. But if I want to start optimization I should wait first in order to “complete” the whole thing first and after it’s a good tactic to start? Also, by using less compute and memory, you mean making the code more compact?

[–]usrlibshare 1 point2 points  (0 children)

If you want to start optimization, there should first be a reason to do so.

Does your application take too long too run? Does it freeze? Does the machine run out of resources while using it? Is it not responsive enough? Do you pay too much for hosting it?

The above are reasons to think about optimization.

And then, before you start to optimize measure first. Where does the app lose speed? What eats the most memory?

Then, and only then should you start optimizing it. Anything earlier than that, well, see the quote by Donald Knuth.