diff options
| author | user <user@clank> | 2026-08-07 02:12:27 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-07 02:12:27 +0200 |
| commit | 414873898f236cdc1ab0d7c6a83f1a58f57f2d6b (patch) | |
| tree | 3609de900f289cb2b3538d427c1c20089ca75854 /idatui/domain.py | |
| parent | Three micro-wins on the listing-row path: merge the colour-tag and operand-ta... (diff) | |
| download | ida-tui-414873898f236cdc1ab0d7c6a83f1a58f57f2d6b.tar.gz ida-tui-414873898f236cdc1ab0d7c6a83f1a58f57f2d6b.tar.xz ida-tui-414873898f236cdc1ab0d7c6a83f1a58f57f2d6b.zip | |
Two hot-path fixes found by profiling the plain-line builder: the opcode-bytes column used a per-byte f-string generator where bytes.hex(' ').upper() does it in one C call (12x), and ListingModel._phys/_head_index_at re-imported bisect on every call. _line_plain 2.64 -> 1.57 us/row.
Result: {"status":"keep","total_ms":19476.3,"lg_boot_ms":756.3,"lg_decomp_ms":2495.1,"lg_graph_ms":946,"lg_hex_ms":905.4,"lg_index_ms":72,"lg_listing_cold_ms":547.5,"lg_listing_warm_ms":410.4,"lg_nav_ms":6723.4,"lg_palette_ms":5,"lg_render_ms":218.8,"lg_search_ms":2312.4,"pure_graph_ms":239.5,"sm_boot_ms":535.3,"sm_decomp_ms":616.4,"sm_graph_ms":682.2,"sm_hex_ms":824.9,"sm_index_ms":0,"sm_listing_cold_ms":258.9,"sm_listing_warm_ms":261,"sm_nav_ms":339.5,"sm_palette_ms":0.3,"sm_render_ms":248.7,"sm_search_ms":77.3,"fails":0}
Diffstat (limited to 'idatui/domain.py')
| -rw-r--r-- | idatui/domain.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/idatui/domain.py b/idatui/domain.py index 645d111..8b423e3 100644 --- a/idatui/domain.py +++ b/idatui/domain.py @@ -754,7 +754,9 @@ class ListingModel: def _phys(self, row: int) -> tuple[int, int]: """(physical head index, byte offset into it) for logical ``row``.""" - import bisect + # bisect is imported at module scope; re-importing it here cost a + # sys.modules lookup on a function that runs once per rendered row and + # once per row a search reads. i = bisect.bisect_right(self._row_at, row) - 1 if i < 0: return (-1, 0) @@ -909,7 +911,6 @@ class ListingModel: def _head_index_at(self, ea: int) -> int: """Index of the physical head containing ``ea`` (caller holds the lock).""" - import bisect eas = self._head_eas i = bisect.bisect_right(eas, ea) - 1 return i if 0 <= i < len(self._heads) else -1 |
