Can anyone explain optimization to me like im 5. Optimization for consoles specifically.
It's all about saving milliseconds when executing code.
It's hard to explain if you're not a programmer, but basically, one single task can be coded and achieved in more than one way, and some ways will be faster in certain situations, and slower in others.
Here, you could, for example, start with an algorythm that serves for all cases, but if you wanna optimize, you separate all possible scenarios on which the algorythm will be executed, and try to adapt various solutions for each scenario.
And also, for any given task, it's always if you speak as directly as possible to the hardware (aka coding to the metal) and avoid as much "intermediaries" as possible, as each intermediary will add execution time.
That's why it's important to know the hardware your game will run on. Optimizations is about resolving puzzles, and the more pieces you have, the better.
If you are all the time in control of all the hardware timings (retrieve data from the disk, upload textures to gpu memory...) and you know how much time is left for your code to run, you can then select wich type of code you can write, being it always a balance between complexity, efficiency, and outcome.
When you have to write code, the easiest and fastest way is to write bad but functional code. But functional is not enough if you want to increase fps as much as possible. You want it to be efficient and save as much processing time as you can. And that is a lot more difficult. And knowing your hardware helps inmensely, by
letting you know what are your real possibilities.
Also, think that any coding trick, even if it's small, and only saves a tiny fraction of a second, can save a lot more if that code runs a lot of times in a small timeframe. Because in optimization, we are talking about small saves (smaller than milliseconds), but a hell lot of them.