|
32 | 32 | import java.io.IOException; |
33 | 33 | import java.nio.file.FileSystems; |
34 | 34 | import java.nio.file.Files; |
35 | | -import java.nio.file.Paths; |
36 | 35 | import java.util.ArrayList; |
37 | 36 | import java.util.Arrays; |
38 | 37 | import java.util.Random; |
@@ -96,13 +95,10 @@ public class BlockReadWriteBenchmarks { |
96 | 95 | DatasetAttributes dsetAttrs; |
97 | 96 | ArrayList<DataBlock<?>> blocks; |
98 | 97 |
|
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 } ) |
101 | 99 | protected String compressionType; |
102 | 100 |
|
103 | | -// @Param( value = { "int8", "int16", "int32", "int64", "float32", "float64" } ) |
104 | | - |
105 | | - @Param( value = { "int8"} ) |
| 101 | + @Param( value = { "int8", "int16", "int32", "int64", "float32", "float64" } ) |
106 | 102 | protected String dataType; |
107 | 103 |
|
108 | 104 | @Param( value = { "3" } ) |
@@ -168,29 +164,22 @@ public void setup() { |
168 | 164 |
|
169 | 165 | } |
170 | 166 |
|
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 | | - |
189 | 167 | @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 | + } |
191 | 174 |
|
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 | + } |
194 | 183 | } |
195 | 184 |
|
196 | 185 | private void fillBlock(DataType dtype, DataBlock<?> blk) { |
|
0 commit comments