added performance_count, tried to optimize naive code.

turns out its pretty hard!
next is blocking which will hopefully make a bigger impact