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.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 elementsprivate 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
-
Constructor Summary
Constructors Modifier Constructor Description private
TestTypedSpeed(byte[] data)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) org.codehaus.stax2.XMLStreamReader2
constructAndFindRoot()
private java.lang.String
findFirstValue(java.io.InputStream in)
static void
main(java.lang.String[] args)
(package private) static byte[]
readData(java.io.File file)
protected int
test()
private int
test2()
protected int
testTypedBooleanAttr(int reps)
protected int
testTypedBooleanElem(int reps)
protected int
testUntypedBooleanAttr(int reps)
protected int
testUntypedBooleanElem(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
-
-