Changed a linked list to an array. Performance is drastically better. Try
holding down the 'f' key right after startup in the old version, and you'll see it bog down quickly. This will never bog down.
This commit is contained in:
parent
aafcd89440
commit
7bf2a0e574
1 changed files with 4 additions and 4 deletions
|
@ -53,7 +53,7 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
* screen, the {@link #newGlyphList glyphList}) is computed on the basis
|
* screen, the {@link #newGlyphList glyphList}) is computed on the basis
|
||||||
* of charList.
|
* of charList.
|
||||||
*/
|
*/
|
||||||
private java.util.LinkedList charList;
|
private java.util.ArrayList charList;
|
||||||
/*
|
/*
|
||||||
* This field holds a copy of the last {@link #newGlyphList}.
|
* This field holds a copy of the last {@link #newGlyphList}.
|
||||||
* Then, when a key is pressed, {@link #charList} is updated, a new
|
* Then, when a key is pressed, {@link #charList} is updated, a new
|
||||||
|
@ -313,7 +313,7 @@ public RTFEditorKit rtfEd = null;
|
||||||
isStackingOn_default = true;
|
isStackingOn_default = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
charList = new LinkedList();
|
charList = new ArrayList();
|
||||||
oldGlyphList = new ArrayList();
|
oldGlyphList = new ArrayList();
|
||||||
newGlyphList = new ArrayList();
|
newGlyphList = new ArrayList();
|
||||||
initKeyboard();
|
initKeyboard();
|
||||||
|
@ -1074,7 +1074,7 @@ public void paste(int offset) {
|
||||||
initKeyboard();
|
initKeyboard();
|
||||||
|
|
||||||
else if (size > 1 && isStackingRightToLeft) {
|
else if (size > 1 && isStackingRightToLeft) {
|
||||||
String s = (String)charList.removeLast();
|
String s = (String)charList.remove(charList.size() - 1);
|
||||||
newGlyphList = TibetanDocument.getGlyphs(charList, isStackingRightToLeft, isDefinitelyTibetan, isDefinitelySanskrit);
|
newGlyphList = TibetanDocument.getGlyphs(charList, isStackingRightToLeft, isDefinitelyTibetan, isDefinitelySanskrit);
|
||||||
oldGlyphList = redrawGlyphs(oldGlyphList, newGlyphList);
|
oldGlyphList = redrawGlyphs(oldGlyphList, newGlyphList);
|
||||||
initKeyboard();
|
initKeyboard();
|
||||||
|
@ -1223,7 +1223,7 @@ public void paste(int offset) {
|
||||||
|
|
||||||
if (isTopHypothesis) {
|
if (isTopHypothesis) {
|
||||||
if (TibetanMachineWeb.isAChungConsonant() && isStackingOn && charList.size()>1 && s2.equals(TibetanMachineWeb.ACHUNG)) {
|
if (TibetanMachineWeb.isAChungConsonant() && isStackingOn && charList.size()>1 && s2.equals(TibetanMachineWeb.ACHUNG)) {
|
||||||
charList.removeLast();
|
charList.remove(charList.size() - 1);
|
||||||
newGlyphList = TibetanDocument.getGlyphs(charList, isStackingRightToLeft, isDefinitelyTibetan, isDefinitelySanskrit);
|
newGlyphList = TibetanDocument.getGlyphs(charList, isStackingRightToLeft, isDefinitelyTibetan, isDefinitelySanskrit);
|
||||||
oldGlyphList = redrawGlyphs(oldGlyphList, newGlyphList);
|
oldGlyphList = redrawGlyphs(oldGlyphList, newGlyphList);
|
||||||
putVowel(TibetanMachineWeb.A_VOWEL);
|
putVowel(TibetanMachineWeb.A_VOWEL);
|
||||||
|
|
Loading…
Reference in a new issue