Profiling code to find bottlenecks