Slight optimization in the profiler implementation