Class DecisionInfo
Parsing performance in ANTLR 4 is heavily influenced by both static factors (e.g. the form of the rules in the grammar) and dynamic factors (e.g. the choice of input and the state of the DFA cache at the time profiling operations are started). For best results, gather and use aggregate statistics from a large sample of inputs representing the inputs expected in production before using the results to make changes in the grammar.
- Since:
- 4.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal List
<AmbiguityInfo> A collection ofAmbiguityInfo
instances describing the ambiguities encountered during LL prediction for this decision.final List
<ContextSensitivityInfo> A collection ofContextSensitivityInfo
instances describing the context sensitivities encountered during LL prediction for this decision.final int
The decision number, which is an index intoATN.decisionToState
.A collection ofErrorInfo
instances describing the parse errors identified during calls toParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
for this decision.long
The total number of timesParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
was invoked for this decision.long
The total number of ATN transitions required during LL prediction for this decision.long
The total number of DFA transitions required during LL prediction for this decision.long
Gets the total number of times SLL prediction completed in a conflict state, resulting in fallback to LL prediction.long
Gets the maximum lookahead required for any single LL prediction to complete for this decision.Gets theLookaheadEventInfo
associated with the event where theLL_MaxLook
value was set.long
Gets the minimum lookahead required for any single LL prediction to complete for this decision.long
The sum of the lookahead required for LL prediction for this decision.final List
<PredicateEvalInfo> A collection ofPredicateEvalInfo
instances describing the results of evaluating individual predicates during prediction for this decision.long
The total number of ATN transitions required during SLL prediction for this decision.long
The total number of DFA transitions required during SLL prediction for this decision.long
Gets the maximum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.Gets theLookaheadEventInfo
associated with the event where theSLL_MaxLook
value was set.long
Gets the minimum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.long
The sum of the lookahead required for SLL prediction for this decision.long
The total time spent inParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
for this decision, in nanoseconds. -
Constructor Summary
ConstructorsConstructorDescriptionDecisionInfo
(int decision) Constructs a new instance of theDecisionInfo
class to contain statistics for a particular decision. -
Method Summary
-
Field Details
-
decision
public final int decisionThe decision number, which is an index intoATN.decisionToState
. -
invocations
public long invocationsThe total number of timesParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
was invoked for this decision. -
timeInPrediction
public long timeInPredictionThe total time spent inParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
for this decision, in nanoseconds.The value of this field contains the sum of differential results obtained by
System.nanoTime()
, and is not adjusted to compensate for JIT and/or garbage collection overhead. For best accuracy, use a modern JVM implementation that provides precise results fromSystem.nanoTime()
, and perform profiling in a separate process which is warmed up by parsing the input prior to profiling. If desired, callATNSimulator.clearDFA()
to reset the DFA cache to its initial state before starting the profiling measurement pass. -
SLL_TotalLook
public long SLL_TotalLookThe sum of the lookahead required for SLL prediction for this decision. Note that SLL prediction is used before LL prediction for performance reasons even whenPredictionMode.LL
orPredictionMode.LL_EXACT_AMBIG_DETECTION
is used. -
SLL_MinLook
public long SLL_MinLookGets the minimum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error. -
SLL_MaxLook
public long SLL_MaxLookGets the maximum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error. -
SLL_MaxLookEvent
Gets theLookaheadEventInfo
associated with the event where theSLL_MaxLook
value was set. -
LL_TotalLook
public long LL_TotalLookThe sum of the lookahead required for LL prediction for this decision. Note that LL prediction is only used when SLL prediction reaches a conflict state. -
LL_MinLook
public long LL_MinLookGets the minimum lookahead required for any single LL prediction to complete for this decision. An LL prediction completes when the algorithm reaches a unique prediction, a conflict state (forPredictionMode.LL
, an ambiguity state (forPredictionMode.LL_EXACT_AMBIG_DETECTION
, or a syntax error. -
LL_MaxLook
public long LL_MaxLookGets the maximum lookahead required for any single LL prediction to complete for this decision. An LL prediction completes when the algorithm reaches a unique prediction, a conflict state (forPredictionMode.LL
, an ambiguity state (forPredictionMode.LL_EXACT_AMBIG_DETECTION
, or a syntax error. -
LL_MaxLookEvent
Gets theLookaheadEventInfo
associated with the event where theLL_MaxLook
value was set. -
contextSensitivities
A collection ofContextSensitivityInfo
instances describing the context sensitivities encountered during LL prediction for this decision.- See Also:
-
errors
A collection ofErrorInfo
instances describing the parse errors identified during calls toParserATNSimulator.adaptivePredict(org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
for this decision.- See Also:
-
ambiguities
A collection ofAmbiguityInfo
instances describing the ambiguities encountered during LL prediction for this decision.- See Also:
-
predicateEvals
A collection ofPredicateEvalInfo
instances describing the results of evaluating individual predicates during prediction for this decision.- See Also:
-
SLL_ATNTransitions
public long SLL_ATNTransitionsThe total number of ATN transitions required during SLL prediction for this decision. An ATN transition is determined by the number of times the DFA does not contain an edge that is required for prediction, resulting in on-the-fly computation of that edge.If DFA caching of SLL transitions is employed by the implementation, ATN computation may cache the computed edge for efficient lookup during future parsing of this decision. Otherwise, the SLL parsing algorithm will use ATN transitions exclusively.
- See Also:
-
SLL_DFATransitions
public long SLL_DFATransitionsThe total number of DFA transitions required during SLL prediction for this decision.If the ATN simulator implementation does not use DFA caching for SLL transitions, this value will be 0.
- See Also:
-
LL_Fallback
public long LL_FallbackGets the total number of times SLL prediction completed in a conflict state, resulting in fallback to LL prediction.Note that this value is not related to whether or not
PredictionMode.SLL
may be used successfully with a particular grammar. If the ambiguity resolution algorithm applied to the SLL conflicts for this decision produce the same result as LL prediction for this decision,PredictionMode.SLL
would produce the same overall parsing result asPredictionMode.LL
. -
LL_ATNTransitions
public long LL_ATNTransitionsThe total number of ATN transitions required during LL prediction for this decision. An ATN transition is determined by the number of times the DFA does not contain an edge that is required for prediction, resulting in on-the-fly computation of that edge.If DFA caching of LL transitions is employed by the implementation, ATN computation may cache the computed edge for efficient lookup during future parsing of this decision. Otherwise, the LL parsing algorithm will use ATN transitions exclusively.
- See Also:
-
LL_DFATransitions
public long LL_DFATransitionsThe total number of DFA transitions required during LL prediction for this decision.If the ATN simulator implementation does not use DFA caching for LL transitions, this value will be 0.
- See Also:
-
-
Constructor Details
-
DecisionInfo
public DecisionInfo(int decision) Constructs a new instance of theDecisionInfo
class to contain statistics for a particular decision.- Parameters:
decision
- The decision number
-
-
Method Details