Skip to content

perf: stop burning frame time in the settings UI - #2

Open
LostPoE wants to merge 1 commit into
exApiTools:masterfrom
LostPoE:perf/imgui-buffers-and-filter-cache
Open

perf: stop burning frame time in the settings UI#2
LostPoE wants to merge 1 commit into
exApiTools:masterfrom
LostPoE:perf/imgui-buffers-and-filter-cache

Conversation

@LostPoE

@LostPoE LostPoE commented Aug 1, 2026

Copy link
Copy Markdown

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 frame

The Craft of Exile import box declared a 10,000,000 byte buffer:

ImGui.InputTextWithHint("##CoEImport", "Craft of Exile Export String..", ref _coeImportData, 10_000_000);

ImGui.NET allocates, zeroes and copies the full declared size on every call, and DrawImportSettings is ImGuiTreeNodeFlags.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 InputTextWithHint buffers 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 frame

The inventory slot selector called FilterHandler.IsItemMatchingCondition for every occupied slot on every frame. Each call constructs a fresh ItemData for the item, which I measured at ~1.4ms, so a full inventory cost roughly 84ms per frame — the overlay visibly stuttered whenever Apply Filter was 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 Steps still 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 with Apply Filter on, and crafting throughput on the same sequence improved substantially (log-measured step times dropped from ~830-940ms to ~200-280ms per currency application, since each await advances one render frame).

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant