Auto-choose batchsize