perf(clickgui): reduce allocations and redundant calls in GUI input pipeline#8539
Open
Pro0101-2b2fr wants to merge 2 commits into
Open
perf(clickgui): reduce allocations and redundant calls in GUI input pipeline#8539Pro0101-2b2fr wants to merge 2 commits into
Pro0101-2b2fr wants to merge 2 commits into
Conversation
e80028b to
6a97404
Compare
6a97404 to
8843649
Compare
Contributor
Author
|
I'm sorry, i merged the current nextgen branch into this one.... |
8843649 to
076e571
Compare
Contributor
Author
Update: Simplified PR scopeAfter testing, the Kotlin-side optimizations (InputListener.kt, CefBrowser.kt) caused issues with window resize and column dragging. Those changes have been removed. This PR now focuses on front-end optimizations only:
All changes seems safe, low-risk optimizations with no behavioral impact. Tested: resize, column drag, search, module toggle colors all work correctly. |
…ipeline - Module.svelte: add CSS contain:layout to reduce layout recalculations - Search.svelte: cache lowercase names/aliases in Map to avoid ~200 toLowerCase() per keystroke - rest.ts: cache lastTypingState to skip redundant HTTP calls on repeated focus/unfocus - ws.ts: pre-stringify PING_PAYLOAD to avoid JSON.stringify() every 5s
076e571 to
ed1a513
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces per-frame allocations and redundant network/compute calls across the entire ClickGUI input + render pipeline (both Kotlin backend and Svelte/TypeScript frontend).
Changes
Backend (Kotlin)
FramebufferResizeEventinstead of everyMouseCursorEventat 60-144Hz. Eliminates 2 double divisions + 4 field reads per mouse event.viewport.transform()calls — removes 1Vector2dallocation per mouse event across 3 call sites (~180-432 object allocations/sec eliminated).mouseClicked/mouseReleased/mouseMoved/mouseScrolled— saves 2 Joml object allocations per input event.Frontend (TypeScript / Svelte)
setTyping()POST calls with a state cache — prevents redundant HTTP requests on rapid focus cycling.toLowerCase()calls per keystroke when searching across 150+ modules.contain: layout— isolates reflow per module element, reducing layout recalculation from O(n) to O(1) on expand/collapse.Performance Impact
Net effect: smoother frame times (fewer GC pauses), lower input latency in GUI, snappier search. Not a raw FPS gain — this targets micro-stutter and 1% lows.
Test Plan
compileKotlinpassesnpm run build(src-theme) passesFiles Changed
Generated with AI assistance.