This answer Count how many posts in category says to use this code
$category = get_category($id);
$count = $category->category_count;
This answer Count how many posts in category says to use this code
$category = get_category($id);
$count = $category->category_count;