This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch perf/final
in repository terminology.
View the commit online.
commit f238f1332e94f7f04be106be1c5b67983cb3f625
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Aug 3 13:50:33 2026 -0600
termpty: skip the cell-copy bookkeeping when no links or blocks exist
TERMPTY_CELL_COPY runs a per-cell loop before its memcpy, testing each cell
for a media-block codepoint and adjusting link refcounts on both source and
destination. Every row that scrolls, every insert and delete, and every row
saved to the backlog pays for it.
None of it can do anything unless this terminal has created a link or a
block: link ids are the only thing that needs refcounting, and blocks are the
only producer of codepoints with bit 31 set. hl.size only ever grows from
zero and block.blocks is only ever assigned, so both tests are true only if
the feature was never used -- and if it was, the full loop still runs.
Checking once per copy instead of three times per cell covers all thirteen
call sites.
Callgrind: 24% fewer instructions on the scroll corpus, 21% on plain ASCII.
Co-Authored-By: Claude Opus 5 <[email protected]>
---
src/bin/termpty.h | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index d2ab89bf..58b84d75 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -396,19 +396,25 @@ do { \
termpty_handle_block_codepoint_overwrite_heavy(Tpty, OLDC, NEWC); \
} while (0)
+/* No cell can carry a link id or a bit-31 block codepoint unless one was ever
+ * created, so the bookkeeping loop is skippable. hl.size and block.blocks both
+ * only ever go from unset to set. */
#define TERMPTY_CELL_COPY(Tpty, Tsrc, Tdst, N) \
do { \
- int __i; \
- \
- for (__i = 0; __i < N; __i++) \
+ if (EINA_UNLIKELY(((Tpty)->hl.size != 0) || ((Tpty)->block.blocks))) \
{ \
- HANDLE_BLOCK_CODEPOINT_OVERWRITE(Tpty, \
- (Tdst)[__i].codepoint, \
- (Tsrc)[__i].codepoint); \
- if (EINA_UNLIKELY((Tdst)[__i].att.link_id)) \
- term_link_refcount_dec(ty, (Tdst)[__i].att.link_id, 1); \
- if (EINA_UNLIKELY((Tsrc)[__i].att.link_id)) \
- term_link_refcount_inc(ty, (Tsrc)[__i].att.link_id, 1); \
+ int __i; \
+ \
+ for (__i = 0; __i < N; __i++) \
+ { \
+ HANDLE_BLOCK_CODEPOINT_OVERWRITE(Tpty, \
+ (Tdst)[__i].codepoint, \
+ (Tsrc)[__i].codepoint); \
+ if (EINA_UNLIKELY((Tdst)[__i].att.link_id)) \
+ term_link_refcount_dec(ty, (Tdst)[__i].att.link_id, 1); \
+ if (EINA_UNLIKELY((Tsrc)[__i].att.link_id)) \
+ term_link_refcount_inc(ty, (Tsrc)[__i].att.link_id, 1); \
+ } \
} \
memcpy(Tdst, Tsrc, N * sizeof(Termcell)); \
} while (0)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.