Skip to content
Permalink
Browse files
CSV-284: Formalize PerformanceTest (#168)
* CSV-284: Formalize PerformanceTest

* Revert some changes
  • Loading branch information
belugabehr committed Jul 15, 2021
1 parent a2ba9b5 commit 47479b630527b7f5b8edc15e8ddda79020761a39
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
@@ -60,3 +60,15 @@ mvn test -Pbenchmark -Dbenchmark=<name>
# Example of running basic "read" benchmark
mvn test -Pbenchmark -Dbenchmark=read
```

Performance Test
-------------

Apache Commons CSV includes a stand-alone performance test which only covers commons-csv.

```shell
# Run the performance test
mvn test -Dtest=PerformanceTest
```

> :warning: This performance test does not use JMH; it uses simple timing metrics.
@@ -19,7 +19,6 @@

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
@@ -46,6 +45,7 @@ public class PerformanceTest {

private final int max = 10;

private static final String TEST_RESRC = "org/apache/commons/csv/perf/worldcitiespop.txt.gz";
private static final File BIG_FILE = new File(System.getProperty("java.io.tmpdir"), "worldcitiespop.txt");

@BeforeAll
@@ -54,10 +54,10 @@ public static void setUpClass() throws FileNotFoundException, IOException {
System.out.println(String.format("Found test fixture %s: %,d bytes.", BIG_FILE, BIG_FILE.length()));
return;
}
System.out.println("Decompressing test fixture " + BIG_FILE + "...");
System.out.println("Decompressing test fixture to: " + BIG_FILE + "...");
try (
final InputStream input = new GZIPInputStream(
new FileInputStream("src/test/resources/perf/worldcitiespop.txt.gz"));
PerformanceTest.class.getClassLoader().getResourceAsStream(TEST_RESRC));
final OutputStream output = new FileOutputStream(BIG_FILE)) {
IOUtils.copy(input, output);
System.out.println(String.format("Decompressed test fixture %s: %,d bytes.", BIG_FILE, BIG_FILE.length()));

0 comments on commit 47479b6

Please sign in to comment.