Skip to content

Commit 3135da2

Browse files
committed
Don't use more threads than available processors
1 parent b816029 commit 3135da2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/test/java/org/janelia/saalfeldlab/n5/N5BenchmarkTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ public void benchmarkParallelWritingSpeed() {
187187

188188
final int nBlocks = 5;
189189

190-
for (int i = 1; i <= 16; i *= 2 ) {
190+
int maxThreads = Math.min(Runtime.getRuntime().availableProcessors(), 16);
191+
for (int i = 1; i <= maxThreads; i *= 2 ) {
191192

192193
System.out.println( i + " threads.");
193194

0 commit comments

Comments
 (0)