From df88eceec9e7975f681fa0177300a4406afe36f1 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 7 Aug 2026 06:23:25 +0200 Subject: Size the worker's per-line render cache to hold a segment's DISTINCT lines (16384 -> 65536, overridable with IDATUI_LINE_CACHE). This was a recorded dead end — it does nothing for a cold sweep — but the rename fix created a second-sweep workload, and re-rendering after a rename is now 21% cheaper. lg_search 7123 -> 5628. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Result: {"status":"keep","total_ms":27552.6,"lg_boot_ms":759.2,"lg_decomp_ms":2754.1,"lg_graph_ms":1207.2,"lg_hex_ms":448,"lg_index_ms":69.6,"lg_listing_cold_ms":434.5,"lg_listing_warm_ms":442.9,"lg_nav_ms":6642.3,"lg_palette_ms":4.7,"lg_rename_ms":730.6,"lg_render_ms":223.6,"lg_search_ms":5627.5,"lg_split_ms":2268,"pure_graph_ms":218.7,"sm_boot_ms":465,"sm_decomp_ms":1290.8,"sm_graph_ms":720.7,"sm_hex_ms":436.1,"sm_index_ms":2.4,"sm_listing_cold_ms":267.2,"sm_listing_warm_ms":266.5,"sm_nav_ms":292.9,"sm_palette_ms":0.3,"sm_rename_ms":380.1,"sm_render_ms":255.5,"sm_search_ms":68.1,"sm_split_ms":1276.3,"fails":0} --- server/patch_server.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'server/patch_server.py') diff --git a/server/patch_server.py b/server/patch_server.py index b8f5453..f3cbe35 100644 --- a/server/patch_server.py +++ b/server/patch_server.py @@ -318,9 +318,27 @@ def _idatui_head_row(ea): import functools as _idatui_functools - - -@_idatui_functools.lru_cache(maxsize=16384) +import os as _idatui_os + +#: Entries in the per-line render cache. Sized to hold a whole segment's +#: DISTINCT lines rather than a working set, because the listing gets rendered +#: TWICE: once when it is first walked, and again after a rename, which restates +#: every row's text. bash's .text is 228 659 rows but only 53 363 distinct +#: lines, and the difference between thrashing and not is the whole win: +#: +#: maxsize first sweep second sweep worker RSS +#: 16 384 17.2 us/row 16.9 us/row +29 MB +#: 32 768 17.0 17.2 +52 MB +#: 65 536 17.0 11.1 +75 MB +#: 131 072 16.9 11.2 +75 MB (working set fits) +#: +#: It is a bound, not a proportion: a bigger binary fills it and stops, so the +#: cost is capped at ~56 MB whatever is open. Lower it with IDATUI_LINE_CACHE if +#: a pool of workers is competing for memory. +_IDATUI_LINE_CACHE = int(_idatui_os.environ.get("IDATUI_LINE_CACHE") or 65536) + + +@_idatui_functools.lru_cache(maxsize=_IDATUI_LINE_CACHE) def _idatui_line_parts(line): """``(text, spans, ops)`` for one tagged disassembly line -- memoised. -- cgit v1.3.1-sl0p