paircounter optimization