Skip to content

Commit b49cbf5

Browse files
committed
Use explicit ExecutorService in GaussBenchmark.
This makes it clear that benchmarkSeparableKernelConvolution() is using the same number of threads as benchmarkSeparableSymmetricConvolution().
1 parent ec75625 commit b49cbf5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/test/java/net/imglib2/algorithm/convolution/GaussBenchmark.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ public class GaussBenchmark
4040
public void benchmarkSeparableKernelConvolution()
4141
{
4242
double[][] halfKernels = Gauss3.halfkernels( new double[] { sigma, sigma, sigma } );
43-
SeparableKernelConvolution.convolution( Kernel1D.symmetric( halfKernels ) ).process( inImage, outImage );
43+
final int numthreads = Runtime.getRuntime().availableProcessors();
44+
final ExecutorService service = Executors.newFixedThreadPool( numthreads );
45+
final Convolution< NumericType< ? > > convolution = SeparableKernelConvolution.convolution( Kernel1D.symmetric( halfKernels ) );
46+
convolution.setExecutor( service );
47+
convolution.process( inImage, outImage );
48+
service.shutdown();
4449
}
4550

4651
@Benchmark

0 commit comments

Comments
 (0)