perf: stop burning frame time in the settings UI - #2
Open
LostPoE wants to merge 1 commit into
Open
Conversation
Two fixes for severe frame-time cost while the plugin's settings panel is visible. Measured with a full inventory of items at 60fps. 1. The Craft of Exile import box declared a 10,000,000 byte buffer. ImGui.NET allocates, zeroes and copies the full declared size on every frame, and the section is DefaultOpen, so this ran continuously whether or not the box was ever used. The largest real CoE export string in Template Crafts is ~118KB, so 500,000 keeps 4x headroom. The other InputTextWithHint buffers held currency base names, condition names and file names, none of which need 100,000 bytes; those are now 2,000. 2. The inventory slot filter highlight called IsItemMatchingCondition per slot per frame. Each call constructs a fresh ItemData for the item, measured at ~1.4ms, so a full bag cost roughly 84ms per frame and made the whole overlay stutter whenever Apply Filter was enabled. Results are now cached in a bool[5,12], recomputed when the query text changes or after 200ms, so slot highlighting stays responsive without re-evaluating every frame. No behaviour change: the same slots highlight, and Apply Steps still evaluates the filter directly at press time. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Two fixes for frame-time cost while the plugin's settings panel is visible. Both show up as overlay-wide stutter, not just slow plugin UI, because they run on the render thread every frame.
1.
CraftingSequenceMenu.cs— 10 MB ImGui buffer allocated every frameThe Craft of Exile import box declared a 10,000,000 byte buffer:
ImGui.NET allocates, zeroes and copies the full declared size on every call, and
DrawImportSettingsisImGuiTreeNodeFlags.DefaultOpen, so this ran continuously whether or not the box was ever touched. At 60fps that is on the order of GB/s of allocate-zero-copy churn from a control most users never use.The largest real export string in
Template Crafts/Craft of Exile Imports/is ~118 KB, so 500,000 leaves 4x headroom.The remaining
InputTextWithHintbuffers were 100,000 bytes each and hold currency base names, condition names and file names — reduced to 2,000.2.
WheresMyCraftAtSettings.cs— filter evaluated per slot per frameThe inventory slot selector called
FilterHandler.IsItemMatchingConditionfor every occupied slot on every frame. Each call constructs a freshItemDatafor the item, which I measured at ~1.4ms, so a full inventory cost roughly 84ms per frame — the overlay visibly stuttered wheneverApply Filterwas enabled.Results are now cached in a
bool[5,12], recomputed when the query text changes or after 200ms.Behaviour
Unchanged. The same slots highlight, and
Apply Stepsstill evaluates the filter directly at press time, so slot selection is never stale.Testing
Built against current ExileCore (
net10.0-windows), 0 errors. Verified in-game on a full inventory: the settings panel went from visibly stuttering to smooth withApply Filteron, and crafting throughput on the same sequence improved substantially (log-measured step times dropped from ~830-940ms to ~200-280ms per currency application, since eachawaitadvances one render frame).🤖 Generated with Claude Code