From: Kevin Lamonte Date: Wed, 8 Mar 2017 16:54:11 +0000 (-0500) Subject: Performance tweaks X-Git-Tag: fanfix-swing-0.0.1~12^2~13^2~281 X-Git-Url: http://git.nikiroo.be/?a=commitdiff_plain;h=6358f6e567422c8a5e880af36bec9ea798cc2cd4;p=fanfix-swing.git Performance tweaks --- diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index e9a7a44c..0a2ab195 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -772,6 +772,9 @@ public class TApplication implements Runnable { // wait until either the backend or the consumer threads have // something to do. try { + if (debugThreads) { + System.err.println("sleep " + timeout + " millis"); + } synchronized (this) { this.wait(timeout); } diff --git a/src/jexer/bits/Cell.java b/src/jexer/bits/Cell.java index d4d78ba3..957ac765 100644 --- a/src/jexer/bits/Cell.java +++ b/src/jexer/bits/Cell.java @@ -101,8 +101,11 @@ public final class Cell extends CellAttributes { } Cell that = (Cell) rhs; - return (super.equals(rhs) - && (ch == that.ch)); + + if (ch == that.ch) { + return super.equals(rhs); + } + return false; } /** diff --git a/src/jexer/bits/CellAttributes.java b/src/jexer/bits/CellAttributes.java index e889e892..43e0b222 100644 --- a/src/jexer/bits/CellAttributes.java +++ b/src/jexer/bits/CellAttributes.java @@ -231,13 +231,13 @@ public class CellAttributes { } CellAttributes that = (CellAttributes) rhs; - return ((bold == that.bold) - && (blink == that.blink) + return ((foreColor == that.foreColor) + && (backColor == that.backColor) + && (bold == that.bold) && (reverse == that.reverse) && (underline == that.underline) - && (protect == that.protect) - && (foreColor == that.foreColor) - && (backColor == that.backColor)); + && (blink == that.blink) + && (protect == that.protect)); } /** diff --git a/src/jexer/io/SwingScreen.java b/src/jexer/io/SwingScreen.java index 24710101..4a602b3c 100644 --- a/src/jexer/io/SwingScreen.java +++ b/src/jexer/io/SwingScreen.java @@ -451,10 +451,12 @@ public final class SwingScreen extends Screen { // Prevent updates to the screen's data from the TApplication // threads. synchronized (screen) { + /* System.err.printf("bounds %s X %d %d Y %d %d\n", bounds, xCellMin, xCellMax, yCellMin, yCellMax); */ + Cell lCellColor = new Cell(); for (int y = yCellMin; y < yCellMax; y++) { for (int x = xCellMin; x < xCellMax; x++) { @@ -469,7 +471,6 @@ public final class SwingScreen extends Screen { || lCell.isBlink() || reallyCleared) { - Cell lCellColor = new Cell(); lCellColor.setTo(lCell); // Check for reverse