Add counter class and performance tests