aboutsummaryrefslogtreecommitdiffstats
path: root/idatui
diff options
context:
space:
mode:
Diffstat (limited to 'idatui')
-rw-r--r--idatui/app.py11
-rw-r--r--idatui/domain.py5
2 files changed, 11 insertions, 5 deletions
diff --git a/idatui/app.py b/idatui/app.py
index 0af47c0..d07a188 100644
--- a/idatui/app.py
+++ b/idatui/app.py
@@ -901,11 +901,16 @@ class ListingView(SearchMixin, NavMixin, ColumnCursor, ScrollView, can_focus=Tru
def _op_bytes_text(self, h: Head) -> str:
"""Hex bytes for ``h``, truncated with an ellipsis in 'limited' mode so a
- long x86-64 instruction doesn't blow out the column."""
+ long x86-64 instruction doesn't blow out the column.
+
+ ``bytes.hex(" ")`` rather than a per-byte f-string generator: this is
+ called for every row of every plain line, and search builds the plain
+ line for the whole segment.
+ """
raw = h.raw or b""
if self._op_mode == 1 and len(raw) > _OP_LIMIT:
- return " ".join(f"{b:02X}" for b in raw[:_OP_LIMIT]) + "\u2026"
- return " ".join(f"{b:02X}" for b in raw)
+ return raw[:_OP_LIMIT].hex(" ").upper() + "\u2026"
+ return raw.hex(" ").upper()
@staticmethod
def _span_segments(h: Head, fallback: Style):
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