Profiling vs Benchmark
People think a benchmark tells you what to fix, and it does not. A profiler watches a whole program run and shows where the time goes. A benchmark times one piece of code many times, so you can compare two versions. Profile first to find the slow part. Then benchmark the old and new versions of that part.
Profiling
Finding the parts of a program that take the most time.
Profiling is measuring where a program spends its time or memory while it runs. A tool called a profiler watches the program and counts how long each function takes. The report shows which parts are slow and which barely matter. Often one small part takes most of the time. Profiling first means you fix the real slow spot instead of guessing.
Benchmark
A test that measures how fast code runs, so you can compare.
A benchmark is a test that measures how fast a piece of code or a system runs. It runs the same task many times and reports a number, like time per run. Running it many times smooths out random noise. You use it to compare two versions, or to check that a change did not make things slower. A benchmark only tells you about the task it runs.
In one line
- Profiling
- Finding the parts of a program that take the most time.
- Benchmark
- A test that measures how fast code runs, so you can compare.