Performance tweaks
authorKevin Lamonte <kevin.lamonte@gmail.com>
Wed, 8 Mar 2017 16:54:11 +0000 (11:54 -0500)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Wed, 8 Mar 2017 16:54:11 +0000 (11:54 -0500)
src/jexer/TApplication.java
src/jexer/bits/Cell.java
src/jexer/bits/CellAttributes.java
src/jexer/io/SwingScreen.java

index e9a7a44c62ddb4c9cd53b17a3ca7eee35e8985b8..0a2ab19548f7a1706b3dec7656803bd7c478fb57 100644 (file)
@@ -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);
                     }
index d4d78ba3ab25b4446eaed222796a055e7fd82a94..957ac7656f8c5e2fb34324ef792b5d97e943c42b 100644 (file)
@@ -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;
     }
 
     /**
index e889e89250c14dcb608bb7fa35132fc89d6b0c1f..43e0b222c751f616e7edf99554a6c63707df59ec 100644 (file)
@@ -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));
     }
 
     /**
index 24710101ee5b1fb44ebe25ee126390e523ccb244..4a602b3c272742e20de3ac02cdf9d00f8282379e 100644 (file)
@@ -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