Search in sources :

Example 11 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class FileBufferPerfTest method runAll.

void runAll(final List polys, final double distance) {
    // System.out.println("Geom count = " + polys.size() + " distance = "
    // + distance);
    final Stopwatch sw = new Stopwatch();
    for (final Iterator i = polys.iterator(); i.hasNext(); ) {
        final Geometry g = (Geometry) i.next();
        g.buffer(distance);
        System.out.print(".");
    }
// System.out.println();
// System.out.println(" Time = " + sw.getTimeString());
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) Stopwatch(com.revolsys.geometry.util.Stopwatch) Iterator(java.util.Iterator)

Example 12 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class PreparedPolygonIntersectsPerfTest method test.

public void test(final Geometry g, final List lines) {
    // System.out.println("AOI # pts: " + g.getVertexCount() + " # lines: "
    // + lines.size() + " # pts in line: " + NUM_LINE_PTS);
    final Stopwatch sw = new Stopwatch();
    int count = 0;
    for (int i = 0; i < MAX_ITER; i++) {
        // count = testPrepGeomNotCached(i, g, lines);
        count = testPrepGeomCached(i, g, lines);
    // count = testOriginal(i, g, lines);
    }
// System.out.println("Count of intersections = " + count);
// System.out.println("Finished in " + sw.getTimeString());
}
Also used : Stopwatch(com.revolsys.geometry.util.Stopwatch) Point(com.revolsys.geometry.model.Point)

Example 13 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class DDExpressionPerf method runDoubleDouble.

public double runDoubleDouble(final int nIter) {
    final Stopwatch sw = new Stopwatch();
    for (int i = 0; i < nIter; i++) {
        final DD a = new DD(9.0);
        final DD factor = new DD(10.0);
        final DD aMul = factor.multiply(a);
        final DD aDiv = a.divide(factor);
        final DD det = a.multiply(a).subtract(aMul.multiply(aDiv));
    // System.out.println(aDiv);
    // System.out.println(det);
    }
    sw.stop();
    // + sw.getTimeString());
    return sw.getTime() / (double) nIter;
}
Also used : DD(com.revolsys.geometry.math.DD) Stopwatch(com.revolsys.geometry.util.Stopwatch)

Example 14 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class DDExpressionPerf method runBigDecimal.

public double runBigDecimal(final int nIter) {
    final Stopwatch sw = new Stopwatch();
    for (int i = 0; i < nIter; i++) {
        final BigDecimal a = new BigDecimal(9.0).setScale(20);
        final BigDecimal factor = new BigDecimal(10.0).setScale(20);
        final BigDecimal aMul = factor.multiply(a);
        final BigDecimal aDiv = a.divide(factor, BigDecimal.ROUND_HALF_UP);
        final BigDecimal det = a.multiply(a).subtract(aMul.multiply(aDiv));
    // System.out.println(aDiv);
    // System.out.println(det);
    }
    sw.stop();
    // + sw.getTimeString());
    return sw.getTime() / (double) nIter;
}
Also used : Stopwatch(com.revolsys.geometry.util.Stopwatch) BigDecimal(java.math.BigDecimal)

Example 15 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class DDExpressionPerf method runDoubleDoubleSelf.

// *
public double runDoubleDoubleSelf(final int nIter) {
    final Stopwatch sw = new Stopwatch();
    for (int i = 0; i < nIter; i++) {
        final double a = 9.0;
        final double factor = 10.0;
        final DD c = new DD(9.0);
        c.selfMultiply(factor);
        final DD b = new DD(9.0);
        b.selfDivide(factor);
        final DD a2 = new DD(a);
        a2.selfMultiply(a);
        final DD b2 = new DD(b);
        b2.selfMultiply(c);
        a2.selfDivide(b2);
        final DD det = a2;
    // System.out.println(aDiv);
    // System.out.println(det);
    }
    sw.stop();
    // + sw.getTimeString());
    return sw.getTime() / (double) nIter;
}
Also used : DD(com.revolsys.geometry.math.DD) Stopwatch(com.revolsys.geometry.util.Stopwatch)

Aggregations

Stopwatch (com.revolsys.geometry.util.Stopwatch)30 Point (com.revolsys.geometry.model.Point)14 Geometry (com.revolsys.geometry.model.Geometry)6 QuadEdgeDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)3 DD (com.revolsys.geometry.math.DD)3 BoundingBox (com.revolsys.geometry.model.BoundingBox)3 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)2 Iterator (java.util.Iterator)2 RectangleLineIntersector (com.revolsys.geometry.algorithm.RectangleLineIntersector)1 PointOnGeometryLocator (com.revolsys.geometry.algorithm.locate.PointOnGeometryLocator)1 SimplePointInAreaLocator (com.revolsys.geometry.algorithm.locate.SimplePointInAreaLocator)1 Interval (com.revolsys.geometry.index.bintree.Interval)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 Location (com.revolsys.geometry.model.Location)1 BoundingBoxDoubleXY (com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)1 SineStarFactory (com.revolsys.geometry.model.util.SineStarFactory)1 Constructor (java.lang.reflect.Constructor)1 Method (java.lang.reflect.Method)1 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1