Skip to content

Commit 7f0e843

Browse files
committed
test: fix BlockReadWriteBenchmarks
1 parent 8c8f100 commit 7f0e843

1 file changed

Lines changed: 16 additions & 27 deletions

File tree

src/test/java/org/janelia/saalfeldlab/n5/universe/benchmarks/BlockReadWriteBenchmarks.java

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.io.IOException;
3333
import java.nio.file.FileSystems;
3434
import java.nio.file.Files;
35-
import java.nio.file.Paths;
3635
import java.util.ArrayList;
3736
import java.util.Arrays;
3837
import java.util.Random;
@@ -96,13 +95,10 @@ public class BlockReadWriteBenchmarks {
9695
DatasetAttributes dsetAttrs;
9796
ArrayList<DataBlock<?>> blocks;
9897

99-
//@Param( value = { RAW_COMPRESSION, GZIP_COMPRESSION, LZ4_COMPRESSION, XZ_COMPRESSION, BLOSC_COMPRESSION, ZSTD_COMPRESSION } )
100-
@Param( value = { RAW_COMPRESSION } )
98+
@Param( value = { RAW_COMPRESSION, GZIP_COMPRESSION, LZ4_COMPRESSION, XZ_COMPRESSION, BLOSC_COMPRESSION, ZSTD_COMPRESSION } )
10199
protected String compressionType;
102100

103-
// @Param( value = { "int8", "int16", "int32", "int64", "float32", "float64" } )
104-
105-
@Param( value = { "int8"} )
101+
@Param( value = { "int8", "int16", "int32", "int64", "float32", "float64" } )
106102
protected String dataType;
107103

108104
@Param( value = { "3" } )
@@ -168,29 +164,22 @@ public void setup() {
168164

169165
}
170166

171-
// @Benchmark
172-
// public void writeBenchmark() throws IOException {
173-
//
174-
// blocks.forEach(blk -> {
175-
// n5.writeBlock(writeGroup, dsetAttrs, blk);
176-
// });
177-
// }
178-
//
179-
// @Benchmark
180-
// public void readBenchmark(Blackhole hole) throws IOException {
181-
//
182-
// final long[] p = new long[numDimensions];
183-
// for (int i = 0; i < numBlocks; i++) {
184-
// p[0] = i;
185-
// hole.consume(n5.readBlock(readGroup, dsetAttrs, p));
186-
// }
187-
// }
188-
189167
@Benchmark
190-
public void fileRead(Blackhole hole) throws IOException {
168+
public void writeBenchmark() throws IOException {
169+
170+
blocks.forEach(blk -> {
171+
n5.writeBlock(writeGroup, dsetAttrs, blk);
172+
});
173+
}
191174

192-
final byte[] bytes = Files.readAllBytes(Paths.get("/home/john/tmp/mri-stack.tif"));
193-
hole.consume(bytes);
175+
@Benchmark
176+
public void readBenchmark(Blackhole hole) throws IOException {
177+
178+
final long[] p = new long[numDimensions];
179+
for (int i = 0; i < numBlocks; i++) {
180+
p[0] = i;
181+
hole.consume(n5.readBlock(readGroup, dsetAttrs, p));
182+
}
194183
}
195184

196185
private void fillBlock(DataType dtype, DataBlock<?> blk) {

0 commit comments

Comments
 (0)