Package test

Class TestTypedSpeed

  • All Implemented Interfaces:
    javax.xml.stream.XMLStreamConstants

    public class TestTypedSpeed
    extends java.lang.Object
    implements javax.xml.stream.XMLStreamConstants
    Simple typed information access stress test, useful for profiling, as well as for quickly checking high-level performance effects of changes (albeit not very accurately, obviously -- need longer running composite tests for such verifications).

    Type of data is auto-detected, and is assumed to be homogenous. Basically, data is either within attributes, or as element content, but not both. In either case structure should be shallow, with the root and only immediate leaf-level elements containing attribute or element data. Type of this data is auto-detected from the first instance; data must be in canonical format to be properly recognized (non-first values can be non-canonical).

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static int MAX_RUN_TIME
      Let's keep per-run times below 300 milliseconds
      (package private) java.io.ByteArrayInputStream mIn  
      (package private) static int MIN_RUN_TIME
      Let's keep per-run times above 50 milliseconds
      (package private) javax.xml.stream.XMLInputFactory mInputFactory  
      (package private) int mType  
      (package private) boolean mUseAttr
      Data in attributes? If true, yes; if no, in elements
      private int REPS
      Number of repetitions to run per test.
      private static int TEST_PER_GC  
      (package private) static int TYPE_BOOLEAN  
      (package private) static int TYPE_INT  
      • Fields inherited from interface javax.xml.stream.XMLStreamConstants

        ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TestTypedSpeed​(byte[] data)  
    • Field Detail

      • REPS

        private int REPS
        Number of repetitions to run per test. Dynamically variable, based on observed runtime, to try to keep it high enough.
      • MIN_RUN_TIME

        static final int MIN_RUN_TIME
        Let's keep per-run times above 50 milliseconds
        See Also:
        Constant Field Values
      • MAX_RUN_TIME

        static final int MAX_RUN_TIME
        Let's keep per-run times below 300 milliseconds
        See Also:
        Constant Field Values
      • mInputFactory

        final javax.xml.stream.XMLInputFactory mInputFactory
      • mIn

        final java.io.ByteArrayInputStream mIn
      • mUseAttr

        boolean mUseAttr
        Data in attributes? If true, yes; if no, in elements
      • mType

        int mType
    • Constructor Detail

      • TestTypedSpeed

        private TestTypedSpeed​(byte[] data)
    • Method Detail

      • test

        protected int test()
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • findFirstValue

        private java.lang.String findFirstValue​(java.io.InputStream in)
                                         throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • test2

        private int test2()
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testUntypedBooleanAttr

        protected int testUntypedBooleanAttr​(int reps)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testUntypedBooleanElem

        protected int testUntypedBooleanElem​(int reps)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testTypedBooleanAttr

        protected int testTypedBooleanAttr​(int reps)
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testTypedBooleanElem

        protected int testTypedBooleanElem​(int reps)
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • constructAndFindRoot

        org.codehaus.stax2.XMLStreamReader2 constructAndFindRoot()
                                                          throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • readData

        static byte[] readData​(java.io.File file)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception