Package test
Class TestTypedSpeed
- java.lang.Object
-
- test.TestTypedSpeed
-
- All Implemented Interfaces:
javax.xml.stream.XMLStreamConstants
public class TestTypedSpeed extends java.lang.Object implements javax.xml.stream.XMLStreamConstantsSimple 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 intMAX_RUN_TIMELet's keep per-run times below 300 milliseconds(package private) java.io.ByteArrayInputStreammIn(package private) static intMIN_RUN_TIMELet's keep per-run times above 50 milliseconds(package private) javax.xml.stream.XMLInputFactorymInputFactory(package private) intmType(package private) booleanmUseAttrData in attributes? If true, yes; if no, in elementsprivate intREPSNumber of repetitions to run per test.private static intTEST_PER_GC(package private) static intTYPE_BOOLEAN(package private) static intTYPE_INT
-
Constructor Summary
Constructors Modifier Constructor Description privateTestTypedSpeed(byte[] data)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) org.codehaus.stax2.XMLStreamReader2constructAndFindRoot()private java.lang.StringfindFirstValue(java.io.InputStream in)static voidmain(java.lang.String[] args)(package private) static byte[]readData(java.io.File file)protected inttest()private inttest2()protected inttestTypedBooleanAttr(int reps)protected inttestTypedBooleanElem(int reps)protected inttestUntypedBooleanAttr(int reps)protected inttestUntypedBooleanElem(int reps)
-
-
-
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.
-
TEST_PER_GC
private static final int TEST_PER_GC
- See Also:
- Constant Field Values
-
TYPE_BOOLEAN
static final int TYPE_BOOLEAN
- See Also:
- Constant Field Values
-
TYPE_INT
static final int TYPE_INT
- See Also:
- Constant Field Values
-
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
-
-
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
-
-