Top Description Fields Constructors Methods
test

public Class TestTypedSpeed

extends Object
implements XMLStreamConstants
Class Inheritance
All Implemented Interfaces
javax.xml.stream.XMLStreamConstants
Imports
java.io.*, javax.xml.stream.*, org.codehaus.stax2.*

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

Modifier and TypeField and Description
pack-priv static final int
MAX_RUN_TIME

Let's keep per-run times below 300 milliseconds

pack-priv final ByteArrayInputStream
pack-priv static final int
MIN_RUN_TIME

Let's keep per-run times above 50 milliseconds

pack-priv final XMLInputFactory
pack-priv int
pack-priv boolean
mUseAttr

Data in attributes?

private int
REPS

Number of repetitions to run per test.

private static final int
pack-priv static final int
pack-priv static final int

Constructor Summary

AccessConstructor and Description
private
TestTypedSpeed(byte[] data)

Method Summary

Modifier and TypeMethod and Description
pack-priv XMLStreamReader2
private String
public static void
main(String[] args)

pack-priv static byte[]
readData(File file)

protected int
test()

private int
protected int
protected int
protected int
protected int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MAX_RUN_TIMEback to summary
pack-priv static final int MAX_RUN_TIME

Let's keep per-run times below 300 milliseconds

mInback to summary
pack-priv final ByteArrayInputStream mIn
MIN_RUN_TIMEback to summary
pack-priv static final int MIN_RUN_TIME

Let's keep per-run times above 50 milliseconds

mInputFactoryback to summary
pack-priv final XMLInputFactory mInputFactory
mTypeback to summary
pack-priv int mType
mUseAttrback to summary
pack-priv boolean mUseAttr

Data in attributes? If true, yes; if no, in elements

REPSback to summary
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_GCback to summary
private static final int TEST_PER_GC
TYPE_BOOLEANback to summary
pack-priv static final int TYPE_BOOLEAN
TYPE_INTback to summary
pack-priv static final int TYPE_INT

Constructor Detail

TestTypedSpeedback to summary
private TestTypedSpeed(byte[] data)

Method Detail

constructAndFindRootback to summary
pack-priv XMLStreamReader2 constructAndFindRoot() throws XMLStreamException
findFirstValueback to summary
private String findFirstValue(InputStream in) throws XMLStreamException
mainback to summary
public static void main(String[] args) throws Exception
readDataback to summary
pack-priv static byte[] readData(File file) throws IOException
testback to summary
protected int test() throws Exception
test2back to summary
private int test2() throws Exception
testTypedBooleanAttrback to summary
protected int testTypedBooleanAttr(int reps) throws Exception
testTypedBooleanElemback to summary
protected int testTypedBooleanElem(int reps) throws Exception
testUntypedBooleanAttrback to summary
protected int testUntypedBooleanAttr(int reps) throws Exception
testUntypedBooleanElemback to summary
protected int testUntypedBooleanElem(int reps) throws Exception