2.6 KiB
2.6 KiB
Apache Commons CSV Benchmark
Apache Commons CSV includes a Java Microbenchmark Harness (JMH) for testing various implementations of CSV processing.
Prerequisite
The Skife CSV implementation is not available in Maven Central and therefore must be manually installed into the local Maven repository. Run the falling script to download and install the JAR file (~1MB).
./benchmark-prereq.sh
Benchmarks
Benchmark Name | CSV Parser | Description |
---|---|---|
read | Java JDK | Use BufferedReader to perform a line count |
scan | Java JDK | Use Scanner to perform a line count |
split | Java JDK | Use BufferedReader to split each line on a delimiter |
parseCommonsCSV | commons-csv | Use CSVFormat to split each line on a delimiter |
parseGenJavaCSV | generation-java | Use CsvReader to split each line on a delimiter |
parseJavaCSV | java-csv | Use CsvReader to split each line on a delimiter |
parseOpenCSV | open-csv | Use CSVReader to split each line on a delimiter |
parseSkifeCSV | skife-csv | Use CSVReader to split each line on a delimiter |
parseSuperCSV | super-csv | Use CsvListReader to split each line on a delimiter |
Running the Tests
# Run all benchmark tests
mvn test -Pbenchmark
# Run a specific benchmark test
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.
# Run the performance test
mvn test -Dtest=PerformanceTest
⚠️ This performance test does not use JMH; it uses simple timing metrics.