A little improvement to JSD2 profiler code (issue 6496)