@@ -61,8 +61,8 @@ public class CSVBenchmark {
6161 */
6262 @ Setup
6363 public void init () throws IOException {
64- File file = new File ("src/test/resources/perf/worldcitiespop.txt.gz" );
65- InputStream in = new GZIPInputStream (new FileInputStream (file ));
64+ final File file = new File ("src/test/resources/perf/worldcitiespop.txt.gz" );
65+ final InputStream in = new GZIPInputStream (new FileInputStream (file ));
6666 this .data = IOUtils .toString (in , "ISO-8859-1" );
6767 in .close ();
6868 }
@@ -72,8 +72,8 @@ private BufferedReader getReader() throws IOException {
7272 }
7373
7474 @ Benchmark
75- public int read (Blackhole bh ) throws Exception {
76- BufferedReader in = getReader ();
75+ public int read (final Blackhole bh ) throws Exception {
76+ final BufferedReader in = getReader ();
7777 int count = 0 ;
7878 String line ;
7979 while ((line = in .readLine ()) != null ) {
@@ -86,12 +86,12 @@ public int read(Blackhole bh) throws Exception {
8686 }
8787
8888 @ Benchmark
89- public int split (Blackhole bh ) throws Exception {
90- BufferedReader in = getReader ();
89+ public int split (final Blackhole bh ) throws Exception {
90+ final BufferedReader in = getReader ();
9191 int count = 0 ;
9292 String line ;
9393 while ((line = in .readLine ()) != null ) {
94- String [] values = StringUtils .split (line , ',' );
94+ final String [] values = StringUtils .split (line , ',' );
9595 count += values .length ;
9696 }
9797
@@ -101,13 +101,13 @@ public int split(Blackhole bh) throws Exception {
101101 }
102102
103103 @ Benchmark
104- public int parseCommonsCSV (Blackhole bh ) throws Exception {
105- BufferedReader in = getReader ();
104+ public int parseCommonsCSV (final Blackhole bh ) throws Exception {
105+ final BufferedReader in = getReader ();
106106
107- CSVFormat format = CSVFormat .DEFAULT .withHeader ();
107+ final CSVFormat format = CSVFormat .DEFAULT .withHeader ();
108108
109109 int count = 0 ;
110- for (CSVRecord record : format .parse (in )) {
110+ for (final CSVRecord record : format .parse (in )) {
111111 count ++;
112112 }
113113
@@ -117,10 +117,10 @@ public int parseCommonsCSV(Blackhole bh) throws Exception {
117117 }
118118
119119 @ Benchmark
120- public int parseGenJavaCSV (Blackhole bh ) throws Exception {
121- BufferedReader in = getReader ();
120+ public int parseGenJavaCSV (final Blackhole bh ) throws Exception {
121+ final BufferedReader in = getReader ();
122122
123- CsvReader reader = new CsvReader (in );
123+ final CsvReader reader = new CsvReader (in );
124124 reader .setFieldDelimiter (',' );
125125
126126 int count = 0 ;
@@ -135,10 +135,10 @@ public int parseGenJavaCSV(Blackhole bh) throws Exception {
135135 }
136136
137137 @ Benchmark
138- public int parseJavaCSV (Blackhole bh ) throws Exception {
139- BufferedReader in = getReader ();
138+ public int parseJavaCSV (final Blackhole bh ) throws Exception {
139+ final BufferedReader in = getReader ();
140140
141- com .csvreader .CsvReader reader = new com .csvreader .CsvReader (in , ',' );
141+ final com .csvreader .CsvReader reader = new com .csvreader .CsvReader (in , ',' );
142142 reader .setRecordDelimiter ('\n' );
143143
144144 int count = 0 ;
@@ -152,10 +152,10 @@ public int parseJavaCSV(Blackhole bh) throws Exception {
152152 }
153153
154154 @ Benchmark
155- public int parseOpenCSV (Blackhole bh ) throws Exception {
156- BufferedReader in = getReader ();
155+ public int parseOpenCSV (final Blackhole bh ) throws Exception {
156+ final BufferedReader in = getReader ();
157157
158- com .opencsv .CSVReader reader = new com .opencsv .CSVReader (in , ',' );
158+ final com .opencsv .CSVReader reader = new com .opencsv .CSVReader (in , ',' );
159159
160160 int count = 0 ;
161161 while (reader .readNext () != null ) {
@@ -168,13 +168,13 @@ public int parseOpenCSV(Blackhole bh) throws Exception {
168168 }
169169
170170 @ Benchmark
171- public int parseSkifeCSV (Blackhole bh ) throws Exception {
172- BufferedReader in = getReader ();
171+ public int parseSkifeCSV (final Blackhole bh ) throws Exception {
172+ final BufferedReader in = getReader ();
173173
174- org .skife .csv .CSVReader reader = new org .skife .csv .SimpleReader ();
174+ final org .skife .csv .CSVReader reader = new org .skife .csv .SimpleReader ();
175175 reader .setSeperator (',' );
176176
177- CountingReaderCallback callback = new CountingReaderCallback ();
177+ final CountingReaderCallback callback = new CountingReaderCallback ();
178178 reader .parse (in , callback );
179179
180180 bh .consume (callback );
@@ -186,16 +186,16 @@ private static class CountingReaderCallback implements org.skife.csv.ReaderCallb
186186 public int count = 0 ;
187187
188188 @ Override
189- public void onRow (String [] fields ) {
189+ public void onRow (final String [] fields ) {
190190 count ++;
191191 }
192192 }
193193
194194 @ Benchmark
195- public int parseSuperCSV (Blackhole bh ) throws Exception {
196- BufferedReader in = getReader ();
195+ public int parseSuperCSV (final Blackhole bh ) throws Exception {
196+ final BufferedReader in = getReader ();
197197
198- CsvListReader reader = new CsvListReader (in , CsvPreference .STANDARD_PREFERENCE );
198+ final CsvListReader reader = new CsvListReader (in , CsvPreference .STANDARD_PREFERENCE );
199199
200200 int count = 0 ;
201201 List <String > record = null ;
0 commit comments