Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 85238 invoked from network); 20 Mar 2008 19:16:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Mar 2008 19:16:22 -0000 Received: (qmail 69012 invoked by uid 500); 20 Mar 2008 19:16:20 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 68950 invoked by uid 500); 20 Mar 2008 19:16:20 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 68941 invoked by uid 99); 20 Mar 2008 19:16:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 12:16:20 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 19:15:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1B26F1A983A; Thu, 20 Mar 2008 12:15:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r639414 - /incubator/cxf/trunk/benchmark/profiling/src/main/java/org/apache/cxf/profile/FastInfosetExperiment.java Date: Thu, 20 Mar 2008 19:15:57 -0000 To: cxf-commits@incubator.apache.org From: bimargulies@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080320191558.1B26F1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bimargulies Date: Thu Mar 20 12:15:57 2008 New Revision: 639414 URL: http://svn.apache.org/viewvc?rev=639414&view=rev Log: improved benchmark. Modified: incubator/cxf/trunk/benchmark/profiling/src/main/java/org/apache/cxf/profile/FastInfosetExperiment.java Modified: incubator/cxf/trunk/benchmark/profiling/src/main/java/org/apache/cxf/profile/FastInfosetExperiment.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/benchmark/profiling/src/main/java/org/apache/cxf/profile/FastInfosetExperiment.java?rev=639414&r1=639413&r2=639414&view=diff ============================================================================== --- incubator/cxf/trunk/benchmark/profiling/src/main/java/org/apache/cxf/profile/FastInfosetExperiment.java (original) +++ incubator/cxf/trunk/benchmark/profiling/src/main/java/org/apache/cxf/profile/FastInfosetExperiment.java Thu Mar 20 12:15:57 2008 @@ -20,6 +20,7 @@ package org.apache.cxf.profile; import com.ctc.wstx.sax.WstxSAXParserFactory; +import com.sun.xml.fastinfoset.dom.DOMDocumentParser; import com.sun.xml.fastinfoset.sax.SAXDocumentParser; import com.sun.xml.fastinfoset.sax.SAXDocumentSerializer; @@ -43,6 +44,8 @@ import javax.xml.transform.dom.DOMResult; import javax.xml.transform.sax.SAXSource; +import org.jvnet.fastinfoset.FastInfosetException; + import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -56,6 +59,7 @@ private DocumentBuilder documentBuilder; TransformerFactory transformerFactory; private File fiFile; + private final static int iterCount = 10000; private FastInfosetExperiment() throws ParserConfigurationException { documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); @@ -112,7 +116,16 @@ is.close(); } - private void benchmark() throws ParserConfigurationException, SAXException, IOException, TransformerConfigurationException, TransformerException { + private void readWithFIDom() throws FastInfosetException, IOException { + InputStream is = new FileInputStream(fiFile); + DOMDocumentParser ddp = new DOMDocumentParser(); + Document document; + document = documentBuilder.newDocument(); + ddp.parse(document, is); + is.close(); + } + + private void benchmark() throws ParserConfigurationException, SAXException, IOException, TransformerConfigurationException, TransformerException, FastInfosetException { InputStream is = getClass().getResourceAsStream("/META-INF/cxf/cxf.xml"); OutputStream os = new FileOutputStream(fiFile); dehydrate(is, os); @@ -121,27 +134,39 @@ long totalTime = 0; - for(int x = 0; x < 100; x ++) { + for(int x = 0; x < iterCount; x ++) { long startTime = System.nanoTime(); readWithWoodstox(); long endTime = System.nanoTime(); totalTime += endTime - startTime; } - double averageNanos = totalTime / 100; + double averageNanos = totalTime / iterCount; System.out.println("Woodstox average us: " + averageNanos / 1000); totalTime = 0; - for(int x = 0; x < 100; x ++) { + for(int x = 0; x < iterCount; x ++) { long startTime = System.nanoTime(); readWithFI(); long endTime = System.nanoTime(); totalTime += endTime - startTime; } - averageNanos = totalTime / 100; + averageNanos = totalTime / iterCount; System.out.println("FastInfoset average us: " + averageNanos / 1000); + + totalTime = 0; + + for(int x = 0; x < iterCount; x ++) { + long startTime = System.nanoTime(); + readWithFIDom(); + long endTime = System.nanoTime(); + totalTime += endTime - startTime; + } + + averageNanos = totalTime / iterCount; + System.out.println("FastInfoset DOM average us: " + averageNanos / 1000); } public static void main(String[] args) throws Exception {