Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BC1F9101C1 for ; Wed, 26 Nov 2014 15:59:08 +0000 (UTC) Received: (qmail 4354 invoked by uid 500); 26 Nov 2014 15:59:08 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 4292 invoked by uid 500); 26 Nov 2014 15:59:08 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 4275 invoked by uid 99); 26 Nov 2014 15:59:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Nov 2014 15:59:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Nov 2014 15:59:06 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 71A142388C92 for ; Wed, 26 Nov 2014 15:57:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r930599 [8/8] - in /websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test: ./ org/ org/apache/ org/apache/commons/ org/apache/commons/csv/ org/apache/commons/csv/perf/ Date: Wed, 26 Nov 2014 15:57:38 -0000 To: commits@commons.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141126155740.71A142388C92@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/PerformanceTest.html ============================================================================== --- websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/PerformanceTest.html (added) +++ websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/PerformanceTest.html Wed Nov 26 15:57:38 2014 @@ -0,0 +1,145 @@ + + + +PerformanceTest xref + + + +
+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  package org.apache.commons.csv.perf;
+19  
+20  import java.io.BufferedReader;
+21  import java.io.File;
+22  import java.io.FileInputStream;
+23  import java.io.FileNotFoundException;
+24  import java.io.FileOutputStream;
+25  import java.io.FileReader;
+26  import java.io.IOException;
+27  import java.io.InputStream;
+28  import java.io.OutputStream;
+29  import java.io.Reader;
+30  import java.util.zip.GZIPInputStream;
+31  
+32  import org.apache.commons.csv.CSVFormat;
+33  import org.apache.commons.csv.CSVRecord;
+34  import org.apache.commons.io.IOUtils;
+35  import org.junit.BeforeClass;
+36  import org.junit.Test;
+37  
+38  /**
+39   * Tests performance.
+40   *
+41   * To run this test, use: mvn test -Dtest=PeformanceTest
+42   *
+43   * @version $Id$
+44   */
+45  @SuppressWarnings("boxing") // test code
+46  public class PerformanceTest {
+47  
+48      private final int max = 10;
+49  
+50      private static final File BIG_FILE = new File(System.getProperty("java.io.tmpdir"), "worldcitiespop.txt");
+51  
+52      @BeforeClass
+53      public static void setUpClass() throws FileNotFoundException, IOException {
+54          if (BIG_FILE.exists()) {
+55              System.out.println(String.format("Found test fixture %s: %,d bytes.", BIG_FILE, BIG_FILE.length()));
+56              return;
+57          }
+58          System.out.println("Decompressing test fixture " + BIG_FILE + "...");
+59          final InputStream input = new GZIPInputStream(new FileInputStream("src/test/resources/perf/worldcitiespop.txt.gz"));
+60          final OutputStream output = new FileOutputStream(BIG_FILE);
+61          IOUtils.copy(input, output);
+62          System.out.println(String.format("Decompressed test fixture %s: %,d bytes.", BIG_FILE, BIG_FILE.length()));
+63          input.close();
+64          output.close();
+65      }
+66  
+67      private BufferedReader getBufferedReader() throws IOException {
+68          return new BufferedReader(new FileReader(BIG_FILE));
+69      }
+70  
+71      private long parse(final Reader in, final boolean traverseColumns) throws IOException {
+72          final CSVFormat format = CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false);
+73          long recordCount = 0;
+74          for (final CSVRecord record : format.parse(in)) {
+75              recordCount++;
+76              if (traverseColumns) {
+77                  for (@SuppressWarnings("unused") final String value : record) {
+78                      // do nothing for now
+79                  }
+80              }
+81          }
+82          return recordCount;
+83      }
+84  
+85      private void println(final String s) {
+86          System.out.println(s);
+87      }
+88  
+89      private long readAll(final BufferedReader in) throws IOException {
+90          long count = 0;
+91          while (in.readLine() != null) {
+92              count++;
+93          }
+94          return count;
+95      }
+96  
+97      public long testParseBigFile(final boolean traverseColumns) throws Exception {
+98          final long startMillis = System.currentTimeMillis();
+99          final long count = this.parse(this.getBufferedReader(), traverseColumns);
+100         final long totalMillis = System.currentTimeMillis() - startMillis;
+101         this.println(String.format("File parsed in %,d milliseconds with Commons CSV: %,d lines.", totalMillis, count));
+102         return totalMillis;
+103     }
+104 
+105     @Test
+106     public void testParseBigFileRepeat() throws Exception {
+107         long bestTime = Long.MAX_VALUE;
+108         for (int i = 0; i < this.max; i++) {
+109             bestTime = Math.min(this.testParseBigFile(false), bestTime);
+110         }
+111         this.println(String.format("Best time out of %,d is %,d milliseconds.", this.max, bestTime));
+112     }
+113 
+114     @Test
+115     public void testReadBigFile() throws Exception {
+116         long bestTime = Long.MAX_VALUE;
+117         for (int i = 0; i < this.max; i++) {
+118             final BufferedReader in = this.getBufferedReader();
+119             final long startMillis = System.currentTimeMillis();
+120             long count = 0;
+121             try {
+122                 count = this.readAll(in);
+123             } finally {
+124                 in.close();
+125             }
+126             final long totalMillis = System.currentTimeMillis() - startMillis;
+127             bestTime = Math.min(totalMillis, bestTime);
+128             this.println(String.format("File read in %,d milliseconds: %,d lines.", totalMillis, count));
+129         }
+130         this.println(String.format("Best time out of %,d is %,d milliseconds.", this.max, bestTime));
+131     }
+132 }
+
+
+ + + Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/PerformanceTest.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/PerformanceTest.html ------------------------------------------------------------------------------ svn:keywords = Id Added: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-frame.html ============================================================================== --- websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-frame.html (added) +++ websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-frame.html Wed Nov 26 15:57:38 2014 @@ -0,0 +1,24 @@ + + + + + + Apache Commons CSV 1.1 Reference Package org.apache.commons.csv.perf + + + + +

+ org.apache.commons.csv.perf +

+ +

Classes

+ + + + + \ No newline at end of file Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-frame.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-frame.html ------------------------------------------------------------------------------ svn:keywords = Id Added: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-summary.html ============================================================================== --- websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-summary.html (added) +++ websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-summary.html Wed Nov 26 15:57:38 2014 @@ -0,0 +1,69 @@ + + + + + + Apache Commons CSV 1.1 Reference Package org.apache.commons.csv.perf + + + +
+ +
+
+ +
+ +

Package org.apache.commons.csv.perf

+ + + + + + + + + + + + +
Class Summary
+ PerformanceTest +
+ +
+ +
+
+ +
+
+ + + \ No newline at end of file Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-summary.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/org/apache/commons/csv/perf/package-summary.html ------------------------------------------------------------------------------ svn:keywords = Id Added: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-frame.html ============================================================================== --- websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-frame.html (added) +++ websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-frame.html Wed Nov 26 15:57:38 2014 @@ -0,0 +1,28 @@ + + + + + + Apache Commons CSV 1.1 Reference + + + + +

+ All Classes +

+ +

Packages

+ + + + + + Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-frame.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-frame.html ------------------------------------------------------------------------------ svn:keywords = Id Added: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-summary.html ============================================================================== --- websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-summary.html (added) +++ websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-summary.html Wed Nov 26 15:57:38 2014 @@ -0,0 +1,71 @@ + + + + + + Apache Commons CSV 1.1 Reference + + + +
+
    +
  • Overview
  • +
  • Package
  • +
+
+
+ +
+ +

Apache Commons CSV 1.1 Reference

+ + + + + + + + + + + + + + + +
Packages
+ org.apache.commons.csv +
+ org.apache.commons.csv.perf +
+ +
+
    +
  • Overview
  • +
  • Package
  • +
+
+
+ +
+ +
+ + + \ No newline at end of file Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-summary.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/overview-summary.html ------------------------------------------------------------------------------ svn:keywords = Id Added: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/stylesheet.css ============================================================================== --- websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/stylesheet.css (added) +++ websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/stylesheet.css Wed Nov 26 15:57:38 2014 @@ -0,0 +1,114 @@ +/* Javadoc style sheet */ +/* Define colors, fonts and other style attributes here to override the defaults */ +body { + background-color: #fff; + font-family: Arial, Helvetica, sans-serif; +} + +a:link { + color: #00f; +} +a:visited { + color: #00a; +} + +a:active, a:hover { + color: #f30 !important; +} + +ul, li { + list-style-type:none; + margin:0; + padding:0; +} + +table td { + padding: 3px; + border: 1px solid #000; +} +table { + width:100%; + border: 1px solid #000; + border-collapse: collapse; +} + +div.overview { + background-color:#ddd; + padding: 4px 4px 4px 0; +} +div.overview li, div.framenoframe li { + display: inline; +} +div.framenoframe { + text-align: center; + font-size: x-small; +} +div.framenoframe li { + margin: 0 3px 0 3px; +} +div.overview li { + margin:3px 3px 0 3px; + padding: 4px; +} +li.selected { + background-color:#888; + color: #fff; + font-weight: bold; +} + +table.summary { + margin-bottom: 20px; +} +table.summary td, table.summary th { + font-weight: bold; + text-align: left; + padding: 3px; +} +table.summary th { + background-color:#036; + color: #fff; +} +table.summary td { + background-color:#eee; + border: 1px solid black; +} + +em { + color: #A00; +} +em.comment { + color: #390; +} +.string { + color: #009; +} + +#overview { + padding:2px; +} + +hr { + height: 1px; + color: #000; +} + +/* JXR style sheet */ +.jxr_comment +{ + color: #390; +} + +.jxr_javadoccomment +{ + color: #A00; +} + +.jxr_string +{ + color: #009; +} + +.jxr_keyword +{ + color: #000; +} Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/stylesheet.css ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-csv/archives/1.1/xref-test/stylesheet.css ------------------------------------------------------------------------------ svn:keywords = Id