Performance improvements to function_trace