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 NameCSV ParserDescription
readJava JDKUse BufferedReader to perform a line count
scanJava JDKUse Scanner to perform a line count
splitJava JDKUse BufferedReader to split each line on a delimiter
parseCommonsCSVcommons-csvUse CSVFormat to split each line on a delimiter
parseGenJavaCSVgeneration-javaUse CsvReader to split each line on a delimiter
parseJavaCSVjava-csvUse CsvReader to split each line on a delimiter
parseOpenCSVopen-csvUse CSVReader to split each line on a delimiter
parseSkifeCSVskife-csvUse CSVReader to split each line on a delimiter
parseSuperCSVsuper-csvUse 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

:warning: This performance test does not use JMH; it uses simple timing metrics.

Performance Test Harness

CSV offers a secondary performance test harness located at: org.apache.commons.csv.PerformanceTest