|
| 1 | +<!--- |
| 2 | + Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + contributor license agreements. See the NOTICE file distributed with |
| 4 | + this work for additional information regarding copyright ownership. |
| 5 | + The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + (the "License"); you may not use this file except in compliance with |
| 7 | + the License. You may obtain a copy of the License at |
| 8 | +
|
| 9 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | + Unless required by applicable law or agreed to in writing, software |
| 12 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + See the License for the specific language governing permissions and |
| 15 | + limitations under the License. |
| 16 | +--> |
| 17 | + |
| 18 | +Apache Commons CSV Benchmark |
| 19 | +=================== |
| 20 | + |
| 21 | +Apache Commons CSV includes a Java Microbenchmark Harness (JMH) for testing various implementations |
| 22 | +of CSV processing. |
| 23 | + |
| 24 | +Prerequisite |
| 25 | +------------- |
| 26 | + |
| 27 | +The Skife CSV implementation is not available in Maven Central and therefore must be manually |
| 28 | +installed into the local Maven repository. Run the falling script to download and install |
| 29 | +the JAR file (~1MB). |
| 30 | + |
| 31 | +```shell |
| 32 | +./benchmark-prereq.sh |
| 33 | +``` |
| 34 | + |
| 35 | +Benchmarks |
| 36 | +------------- |
| 37 | + |
| 38 | +Benchmark Name | CSV Parser | Description |
| 39 | +--------------- | --------------- | ------------- |
| 40 | +read | Java JDK | Use BufferedReader to perform a line count |
| 41 | +scan | Java JDK | Use Scanner to perform a line count |
| 42 | +split | Java JDK | Use BufferedReader to split each line on a delimiter |
| 43 | +parseCommonsCSV | commons-csv | Use CSVFormat to split each line on a delimiter |
| 44 | +parseGenJavaCSV | generation-java | Use CsvReader to split each line on a delimiter |
| 45 | +parseJavaCSV | java-csv | Use CsvReader to split each line on a delimiter |
| 46 | +parseOpenCSV | open-csv | Use CSVReader to split each line on a delimiter |
| 47 | +parseSkifeCSV | skife-csv | Use CSVReader to split each line on a delimiter |
| 48 | +parseSuperCSV | super-csv | Use CsvListReader to split each line on a delimiter |
| 49 | + |
| 50 | +Running the Tests |
| 51 | +------------- |
| 52 | + |
| 53 | +```shell |
| 54 | +# Run all benchmark tests |
| 55 | +mvn test -Pbenchmark |
| 56 | + |
| 57 | +# Run a specific benchmark test |
| 58 | +mvn test -Pbenchmark -Dbenchmark=<name> |
| 59 | + |
| 60 | +# Example of running basic "read" benchmark |
| 61 | +mvn test -Pbenchmark -Dbenchmark=read |
| 62 | +``` |
0 commit comments