There is no way your keyboard event testing code is a performance bottleneck. If your benchmarking says that it is, then either your benchmarks are broken or you're really doing it wrong.