Increase read buffer size from 4KB to 64KB

The small buffer size has caused serious lags in large content use cases
like scrolling on terminal multiplexers.
This commit is contained in:
Jonathan LEI
2026-02-19 00:27:45 +08:00
committed by Fredrik Fornwall
parent e50ac9e019
commit ef4775b651

View File

@@ -41,7 +41,7 @@ public final class TerminalSession extends TerminalOutput {
* A queue written to from a separate thread when the process outputs, and read by main thread to process by
* terminal emulator.
*/
final ByteQueue mProcessToTerminalIOQueue = new ByteQueue(4096);
final ByteQueue mProcessToTerminalIOQueue = new ByteQueue(64 * 1024);
/**
* A queue written to from the main thread due to user interaction, and read by another thread which forwards by
* writing to the {@link #mTerminalFileDescriptor}.
@@ -336,7 +336,7 @@ public final class TerminalSession extends TerminalOutput {
@SuppressLint("HandlerLeak")
class MainThreadHandler extends Handler {
final byte[] mReceiveBuffer = new byte[4 * 1024];
final byte[] mReceiveBuffer = new byte[64 * 1024];
@Override
public void handleMessage(Message msg) {