Profiling is a technique for investigating the behavior of a program using information gathered during the execution or running of the program. The goal of code profiling is to determine which parts of a program to optimize for speed or memory usage.