doing less work in local trace function

removed three function calls and a few attribute accesses on every round of the local trace function