Speedup event filtering

I got a 30% boost on my computer for a simple
benchmark.