Skip to content

Commit

Permalink
Add threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Jan 21, 2024
1 parent 247824d commit 7e8e717
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flox/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ def chunk_unique(labels, slicer, nlabels, label_is_present=None):
uniques = ilabels[label_is_present[:-1]]
return uniques

if nlabels < approx_chunk_size:
if nlabels < 5 * approx_chunk_size:
logger.debug("Using threadpool since %s < 5 * %s", nlabels, approx_chunk_size)
with ThreadPoolExecutor() as executor:
futures = [
executor.submit(chunk_unique, labels, slicer, nlabels)
Expand Down

0 comments on commit 7e8e717

Please sign in to comment.