Introduction
Programs can sometimes run slower or use more resources than needed, making computers less efficient. Improving how a program runs helps it finish tasks faster and use less power or memory.
Imagine cleaning a messy room. If you pick up only the trash and leave things scattered, it takes longer to find what you need later. But if you organize and remove clutter, you can find things quickly and finish cleaning faster.
┌───────────────────────────────┐ │ Program Execution │ ├─────────────┬─────────────────┤ │ Unoptimized │ Optimized │ ├─────────────┼─────────────────┤ │ Extra steps │ Removed steps │ │ Wastes CPU │ Efficient CPU │ │ Uses more │ Uses less │ │ memory │ memory │ │ Slower │ Faster │ └─────────────┴─────────────────┘