remove global function, sub_partition and define sub_partition in partition_slow