1 18 package org.apache.batik.svggen; 19 20 import org.w3c.dom.Document ; 21 import org.w3c.dom.DOMImplementation ; 22 23 import org.apache.batik.dom.svg.SVGDOMImplementation; 24 import org.apache.batik.test.PerformanceTest; 25 26 33 public class DoubleStringPerformanceTest extends PerformanceTest { 34 static double[] testValues = { 0, 35 0.00000000001, 36 0.2e-14, 37 0.45, 38 123412341234e14, 39 987654321e-12, 40 234143, 41 2.3333444000044e56, 42 45.3456 }; 43 public void runOp() { 44 DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); 45 String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; 46 Document doc = impl.createDocument(svgNS, "svg", null); 47 final SVGGeneratorContext gc = new SVGGeneratorContext(doc); 48 49 int maxLength = 0; 50 for (int i=0; i<1000; i++) { 51 for (int j=0; j<testValues.length; j++) { 52 maxLength = Math.max((gc.doubleString(testValues[j])).length(), maxLength); 53 } 54 } 55 } 56 } 57 | Popular Tags |