Skip to content

Commit 0771927

Browse files
authored
CSV-282: Document and Automate CSV Benchmark Harness (apache#166)
* CSV-282: Document and Automate CSV Benchmark Harness * Editorial improvements
1 parent c640d16 commit 0771927

3 files changed

Lines changed: 88 additions & 0 deletions

File tree

BENCHMARK.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
```

benchmark-prereq.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
##
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
20+
wget -P /tmp https://kasparov.skife.org/csv/csv-1.0.jar
21+
22+
mvn -version
23+
24+
mvn install:install-file -Dfile=/tmp/csv-1.0.jar -DgroupId=org.skife.kasparov -DartifactId=csv -Dversion=1.0 -Dpackaging=jar
25+

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@
452452
<groupId>org.skife.kasparov</groupId>
453453
<artifactId>csv</artifactId>
454454
<version>1.0</version>
455+
<scope>provided</scope>
455456
</dependency>
456457

457458
<dependency>

0 commit comments

Comments
 (0)