Class Harness


  • public class Harness
    extends java.lang.Object
    Deprecated.
    As of 1.4.9 use JMH instead
    A simple harness for running benchmarks over object serialization products.

    There are three dimensions that can be added:

    • Product (e.g. DOM, SAX, XPP...)
    • Metric (e.g. time taken, memory usage, output size...)
    • Target (e.g. a small object, large object, list of objects...)

    The Harness will then across every permutation of these (in order of product, metric, target), and write the results to a Reporter.

    Example usage

     Harness harness = new Harness();
    
     // Compare speed of serialization/deserialization metrics...
     harness.addMetric(new SerializationSpeedMetric());
     harness.addMetric(new DeserializationSpeedMetric());
    
     // Using a simple String and a JTree instance...
     harness.addTarget(new StringTarget());
     harness.addTarget(new JTreeTarget());
    
     // Across XStream with different XML drivers.
     harness.addProduct(new XStreamDom());
     harness.addProduct(new XStreamXpp());
     harness.addProduct(new XStreamSax());
    
     // Now do it, and report the results as text to the console.
     harness.run(new TextReporter());
     
    • Field Detail

      • products

        private java.util.List products
        Deprecated.
      • targets

        private java.util.List targets
        Deprecated.
      • metrics

        private java.util.List metrics
        Deprecated.
    • Constructor Detail

      • Harness

        public Harness()
        Deprecated.
    • Method Detail

      • addProduct

        public void addProduct​(Product product)
        Deprecated.
      • addTarget

        public void addTarget​(Target target)
        Deprecated.
      • addMetric

        public void addMetric​(Metric metric)
        Deprecated.
      • run

        public void run​(Reporter reporter)
        Deprecated.