diff options
author | Kenny Root <kenny@the-b.org> | 2009-01-16 18:16:48 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2009-01-16 18:16:48 +0000 |
commit | bfac23d58a1260f61de6c69be4e80b2d85e045ac (patch) | |
tree | 24388437cd111b1c49e03936a4021f3748bb427e /src/org | |
parent | 4031f5d160d90a19846c161dac15dd9fb5028a73 (diff) | |
download | connectbot-bfac23d58a1260f61de6c69be4e80b2d85e045ac.tar.gz connectbot-bfac23d58a1260f61de6c69be4e80b2d85e045ac.tar.bz2 connectbot-bfac23d58a1260f61de6c69be4e80b2d85e045ac.zip |
Some call optimizations to make terminal emulation faster
* Instead of making a String and then breaking it down again, pass in our Character array
* Don't bother checking the type of a Character below or equal to 0x7F because it's ASCII
* We don't always need to know the bottom and top margins, so only call getTopMargin() or getBottomMargin() when we do
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/connectbot/service/TerminalBridge.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java index e7bb274..07e96f7 100644 --- a/src/org/connectbot/service/TerminalBridge.java +++ b/src/org/connectbot/service/TerminalBridge.java @@ -509,9 +509,11 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal Log.e(TAG, "Session established, cannot use outputLine!", new IOException("outputLine call traceback")); synchronized (localOutput) { - localOutput.add(line + "\r\n"); + final String s = line + "\r\n"; - ((vt320) buffer).putString(line + "\r\n"); + localOutput.add(s); + + ((vt320) buffer).putString(s); } redraw(); @@ -628,7 +630,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal /* There is good data before the malformed section, so * pass this on immediately. */ - ((vt320)buffer).putString(new String(cb.array(), 0, cb.position())); + ((vt320)buffer).putString(cb.array(), 0, cb.position()); } while (bb.position() < n) { @@ -637,7 +639,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal cb.clear(); replacer.decode(bb, cb, true); - ((vt320) buffer).putString(new String(cb.array(), 0, cb.position())); + ((vt320) buffer).putString(cb.array(), 0, cb.position()); curpos += cr.length(); @@ -665,12 +667,12 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal )); } else { // After discarding the previous offset, we only have valid data. - ((vt320)buffer).putString(new String(cb.array(), 0, cb.position())); + ((vt320)buffer).putString(cb.array(), 0, cb.position()); offset = 0; } } else { // No errors at all. - ((vt320)buffer).putString(new String(cb.array(), 0, cb.position())); + ((vt320)buffer).putString(cb.array(), 0, cb.position()); offset = 0; } |