DFA cache on again; dropped from 25 to 16M!!!

This commit is contained in:
Terence Parr 2012-07-28 10:34:34 -07:00
parent 8a301f59f8
commit eda95f7478
2 changed files with 5 additions and 6 deletions

View File

@ -269,13 +269,12 @@ public class ATNConfigSet implements Set<ATNConfig> {
*/
protected boolean readonly = false;
/** Track every config we add */
// public final LinkedHashMap<Key,ATNConfig> configToContext;
/** All configs but hashed by (s, i, _, pi) not incl context */
/** All configs but hashed by (s, i, _, pi) not incl context. Wiped out
* when we go readonly as this set becomes a DFA state.
*/
public ConfigHashSet configLookup;
/** Track the elements as they are added to the set; supports get(i) */
// too hard to keep in sync
public final ArrayList<ATNConfig> configs = new ArrayList<ATNConfig>(7);
// TODO: these fields make me pretty uncomfortable but nice to pack up info together, saves recomputation

View File

@ -51,8 +51,8 @@ public abstract class ATNSimulator {
* fill this during closure() since there are lots of contexts that
* pop up but are not used ever again. It also greatly slows down closure().
*/
protected final PredictionContextCache sharedContextCache = null;
//new PredictionContextCache("shared DFA state context cache");
protected final PredictionContextCache sharedContextCache =
new PredictionContextCache("shared DFA state context cache");
/** This context cache tracks all context graphs used during a single
* ATN-based prediction operation. There will be significant context graph