From 9f6b001185b0511bc9081de3fdb9a1d885422d68 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 25 Dec 2023 18:08:59 +0100 Subject: [PATCH] cleanup --- .../src/utils/pluginEventDataBatcher.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/apps/remixdesktop/src/utils/pluginEventDataBatcher.ts b/apps/remixdesktop/src/utils/pluginEventDataBatcher.ts index 2a380b2053..c28804cc96 100644 --- a/apps/remixdesktop/src/utils/pluginEventDataBatcher.ts +++ b/apps/remixdesktop/src/utils/pluginEventDataBatcher.ts @@ -1,26 +1,18 @@ import {EventEmitter} from 'events'; -import { StringDecoder } from 'string_decoder'; + // Max duration to batch session data before sending it to the renderer process. const BATCH_DURATION_MS = 16; -// Max size of a session data batch. Note that this value can be exceeded by ~4k -// (chunk sizes seem to be 4k at the most) -const BATCH_MAX_SIZE = 200 * 1024; +// Max number of events to batch before sending them to the renderer process. +const BATCH_MAX_SIZE = 50; -// Data coming from the pty is sent to the renderer process for further -// vt parsing and rendering. This class batches data to minimize the number of -// IPC calls. It also reduces GC pressure and CPU cost: each chunk is prefixed -// with the window ID which is then stripped on the renderer process and this -// overhead is reduced with batching. export class PluginEventDataBatcher extends EventEmitter { uid: number; - decoder: StringDecoder; data!: any[] timeout!: NodeJS.Timeout | null; constructor(uid: number) { super(); this.uid = uid; - this.decoder = new StringDecoder('utf8'); this.reset(); }