forked from Blendman974/faceclaw
Performance optimizations
This commit is contained in:
1 parent
e49c699062
commit
f6035ea9ec
18 files changed
+715
-158
No files matched your search
@@ -210,6 +210,9 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
}
|
||||
window.focused = message.focused;
|
||||
inferForeground(window, message.focused);
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
@@ -650,7 +653,7 @@ function renderAndSubmit(window: BlocksWindow, inputFrameId: number): void {
|
||||
return;
|
||||
}
|
||||
const { image, draws } = frameTimings.span(frameId, "flatten", () => flattenPlanesWithDraws(planes));
|
||||
const buffer = image.to8bppBuffer();
|
||||
const buffer = frameTimings.span(frameId, "to8bpp", () => image.to8bppBuffer());
|
||||
communicator.submitSurfaceFrame(
|
||||
buffer.buffer,
|
||||
window.surfaceId,
|
||||
@@ -661,7 +664,7 @@ function renderAndSubmit(window: BlocksWindow, inputFrameId: number): void {
|
||||
fingerprint,
|
||||
paintMs,
|
||||
frameId,
|
||||
prepareFrameDraws(draws),
|
||||
frameTimings.span(frameId, "prepareFrameDraws", () => prepareFrameDraws(draws)),
|
||||
);
|
||||
window.lastSubmittedFingerprint = fingerprint;
|
||||
} catch (error) {
|
||||
|
||||
@@ -165,6 +165,9 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
break;
|
||||
}
|
||||
window.focused = message.focused;
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
@@ -755,7 +758,7 @@ function renderAndSubmit(window: FreecellWindow, inputFrameId: number): void {
|
||||
return;
|
||||
}
|
||||
const { image, draws } = frameTimings.span(frameId, "flatten", () => flattenPlanesWithDraws(planes));
|
||||
const buffer = image.to8bppBuffer();
|
||||
const buffer = frameTimings.span(frameId, "to8bpp", () => image.to8bppBuffer());
|
||||
communicator.submitSurfaceFrame(
|
||||
buffer.buffer,
|
||||
window.surfaceId,
|
||||
@@ -766,7 +769,7 @@ function renderAndSubmit(window: FreecellWindow, inputFrameId: number): void {
|
||||
fingerprint,
|
||||
paintMs,
|
||||
frameId,
|
||||
prepareFrameDraws(draws),
|
||||
frameTimings.span(frameId, "prepareFrameDraws", () => prepareFrameDraws(draws)),
|
||||
);
|
||||
window.lastSubmittedFingerprint = fingerprint;
|
||||
} catch (error) {
|
||||
|
||||
@@ -175,6 +175,9 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
}
|
||||
window.focused = message.focused;
|
||||
inferForeground(window, message.focused);
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
@@ -714,7 +717,7 @@ function renderAndSubmit(window: MinesweeperWindow, inputFrameId: number): void
|
||||
return;
|
||||
}
|
||||
const { image, draws } = frameTimings.span(frameId, "flatten", () => flattenPlanesWithDraws(planes));
|
||||
const buffer = image.to8bppBuffer();
|
||||
const buffer = frameTimings.span(frameId, "to8bpp", () => image.to8bppBuffer());
|
||||
communicator.submitSurfaceFrame(
|
||||
buffer.buffer,
|
||||
window.surfaceId,
|
||||
@@ -725,7 +728,7 @@ function renderAndSubmit(window: MinesweeperWindow, inputFrameId: number): void
|
||||
fingerprint,
|
||||
paintMs,
|
||||
frameId,
|
||||
prepareFrameDraws(draws),
|
||||
frameTimings.span(frameId, "prepareFrameDraws", () => prepareFrameDraws(draws)),
|
||||
);
|
||||
window.lastSubmittedFingerprint = fingerprint;
|
||||
} catch (error) {
|
||||
|
||||
@@ -175,6 +175,9 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
break;
|
||||
}
|
||||
window.focused = message.focused;
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
break;
|
||||
case "text-input":
|
||||
@@ -876,7 +879,7 @@ function renderAndSubmit(win: NavWindow, inputFrameId: number): void {
|
||||
return;
|
||||
}
|
||||
const { image, draws } = frameTimings.span(frameId, "flatten", () => flattenPlanesWithDraws(planes));
|
||||
const buffer = image.to8bppBuffer();
|
||||
const buffer = frameTimings.span(frameId, "to8bpp", () => image.to8bppBuffer());
|
||||
communicator.submitSurfaceFrame(
|
||||
buffer.buffer,
|
||||
win.surfaceId,
|
||||
@@ -887,7 +890,7 @@ function renderAndSubmit(win: NavWindow, inputFrameId: number): void {
|
||||
fingerprint,
|
||||
paintMs,
|
||||
frameId,
|
||||
prepareFrameDraws(draws),
|
||||
frameTimings.span(frameId, "prepareFrameDraws", () => prepareFrameDraws(draws)),
|
||||
);
|
||||
win.lastSubmittedFingerprint = fingerprint;
|
||||
} catch (error) {
|
||||
|
||||
@@ -346,6 +346,9 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
}
|
||||
window.focused = message.focused;
|
||||
inferForeground(window, message.focused);
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
@@ -1043,7 +1046,7 @@ function renderAndSubmit(window: PinballWindow, inputFrameId: number): void {
|
||||
return;
|
||||
}
|
||||
const { image, draws } = frameTimings.span(frameId, "flatten", () => flattenPlanesWithDraws(planes));
|
||||
const buffer = image.to8bppBuffer();
|
||||
const buffer = frameTimings.span(frameId, "to8bpp", () => image.to8bppBuffer());
|
||||
communicator.submitSurfaceFrame(
|
||||
buffer.buffer,
|
||||
window.surfaceId,
|
||||
@@ -1054,7 +1057,7 @@ function renderAndSubmit(window: PinballWindow, inputFrameId: number): void {
|
||||
fingerprint,
|
||||
paintMs,
|
||||
frameId,
|
||||
prepareFrameDraws(draws),
|
||||
frameTimings.span(frameId, "prepareFrameDraws", () => prepareFrameDraws(draws)),
|
||||
);
|
||||
window.lastSubmittedFingerprint = fingerprint;
|
||||
} catch (error) {
|
||||
|
||||
@@ -176,6 +176,9 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
}
|
||||
window.focused = message.focused;
|
||||
inferForeground(message.focused);
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
break;
|
||||
case "text-input":
|
||||
@@ -595,7 +598,7 @@ function renderAndSubmit(win: RoamWindow, inputFrameId: number): void {
|
||||
return;
|
||||
}
|
||||
const { image, draws } = frameTimings.span(frameId, "flatten", () => flattenPlanesWithDraws(planes));
|
||||
const buffer = image.to8bppBuffer();
|
||||
const buffer = frameTimings.span(frameId, "to8bpp", () => image.to8bppBuffer());
|
||||
communicator.submitSurfaceFrame(
|
||||
buffer.buffer,
|
||||
win.surfaceId,
|
||||
@@ -606,7 +609,7 @@ function renderAndSubmit(win: RoamWindow, inputFrameId: number): void {
|
||||
fingerprint,
|
||||
paintMs,
|
||||
frameId,
|
||||
prepareFrameDraws(draws),
|
||||
frameTimings.span(frameId, "prepareFrameDraws", () => prepareFrameDraws(draws)),
|
||||
);
|
||||
win.lastSubmittedFingerprint = fingerprint;
|
||||
} catch (error) {
|
||||
|
||||
@@ -320,6 +320,9 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
break;
|
||||
}
|
||||
window.focused = message.focused;
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
@@ -1615,7 +1618,7 @@ function renderAndSubmit(window: TerminalWindow, inputFrameId: number): void {
|
||||
return;
|
||||
}
|
||||
const { image, draws } = frameTimings.span(frameId, "flatten", () => flattenPlanesWithDraws(planes));
|
||||
const buffer = image.to8bppBuffer();
|
||||
const buffer = frameTimings.span(frameId, "to8bpp", () => image.to8bppBuffer());
|
||||
communicator.submitSurfaceFrame(
|
||||
buffer.buffer,
|
||||
window.surfaceId,
|
||||
@@ -1626,7 +1629,7 @@ function renderAndSubmit(window: TerminalWindow, inputFrameId: number): void {
|
||||
fingerprint,
|
||||
paintMs,
|
||||
frameId,
|
||||
prepareFrameDraws(draws),
|
||||
frameTimings.span(frameId, "prepareFrameDraws", () => prepareFrameDraws(draws)),
|
||||
);
|
||||
window.lastSubmittedFingerprint = fingerprint;
|
||||
} catch (error) {
|
||||
|
||||
@@ -162,6 +162,9 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
break;
|
||||
}
|
||||
window.focused = message.focused;
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
@@ -666,7 +669,7 @@ function renderAndSubmit(window: TimerWindow, inputFrameId: number): void {
|
||||
return;
|
||||
}
|
||||
const { image, draws } = frameTimings.span(frameId, "flatten", () => flattenPlanesWithDraws(planes));
|
||||
const buffer = image.to8bppBuffer();
|
||||
const buffer = frameTimings.span(frameId, "to8bpp", () => image.to8bppBuffer());
|
||||
communicator.submitSurfaceFrame(
|
||||
buffer.buffer,
|
||||
window.surfaceId,
|
||||
@@ -677,7 +680,7 @@ function renderAndSubmit(window: TimerWindow, inputFrameId: number): void {
|
||||
fingerprint,
|
||||
paintMs,
|
||||
frameId,
|
||||
prepareFrameDraws(draws),
|
||||
frameTimings.span(frameId, "prepareFrameDraws", () => prepareFrameDraws(draws)),
|
||||
);
|
||||
window.lastSubmittedFingerprint = fingerprint;
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user