minor performance improvements in switch + perf test