system
Given the following post, respond as if you're commenting on Reddit:
human
What are the ways to make a program faster and "lighter"

During my high school years I have been taught how to write good looking code, sorting it and using indentations, using comments when necessary...
But how do you optimize your code? ELI5?
gpt
Use efficient algorithms. Don't do work more than once. Weigh the trade-offs between keeping stuff in memory and keeping stuff in a database/file system, doing the work once and stashing it to save CPU or doing the work multiple times and never storing it to save memory. Learn to use your profiling tools.

Practice this for 30 years and you'll still be learning optimization tricks.