com.sun.msv.grammar
public class ExpressionPool extends Object implements Serializable
Although this unification is essential, this is also the performance bottle neck. In particular, createChoice and createSequence are two most commonly called methods.
For example, when validating a DocBook XML (150KB) twice against DocBook.trex(237KB), createChoice is called 63000 times and createSequence called 23000 times. (the third is the createOptional method and only 1560 times.) And they took more than 10% of validation time, which is the worst time-consuming method.
Therefore, please beware that this class includes several ugly code optimization.
Nested Class Summary | |
---|---|
static class | ExpressionPool.ClosedHash
expression cache by closed hash.
|
Constructor Summary | |
---|---|
ExpressionPool(ExpressionPool parent)
creates new expression pool as a child pool of the given parent pool.
| |
ExpressionPool() |
Method Summary | |
---|---|
Expression | createAnyString() |
Expression | createAttribute(NameClass nameClass) |
Expression | createAttribute(NameClass nameClass, Expression content) |
Expression | createChoice(Expression left, Expression right) |
Expression | createConcur(Expression left, Expression right) |
Expression | createData(XSDatatype dt) |
Expression | createData(Datatype dt, StringPair typeName) |
Expression | createData(Datatype dt, StringPair typeName, Expression except) |
Expression | createEpsilon() |
Expression | createInterleave(Expression left, Expression right) |
Expression | createList(Expression exp) |
Expression | createMixed(Expression body) |
Expression | createNullSet() |
Expression | createOneOrMore(Expression child) |
Expression | createOptional(Expression child) |
Expression | createSequence(Expression left, Expression right) |
Expression | createValue(XSDatatype dt, Object value) |
Expression | createValue(Datatype dt, StringPair typeName, Object value) |
Expression | createZeroOrMore(Expression child) |
Every expression memorized in the parent pool can be retrieved, but update operations are only performed upon the child pool. In this way, the parent pool can be shared among the multiple threads without interfering performance.
Furthermore, you can throw away a child pool after a certain time period to prevent it from eating up memory.