Optimize get_maxed_out_subnets() and num_children().