Skip to content

Add optimizations: cache term.move_yx and anchor animation to wall time - #403

Closed
btpence wants to merge 1 commit into
jquast:masterfrom
btpence:scroller-memoise-move-yx
Closed

btpence wants to merge 1 commit into
jquast:masterfrom
btpence:scroller-memoise-move-yx

Conversation

@btpence

@btpence btpence commented Aug 21, 2026

Copy link
Copy Markdown

Caching move_yx is worth 4.2x on its own. It rebuilds the escape sequence from scratch on every call, and we call it for every character on every frame.

Anchoring to wall time lets the animation run on a consistent time scale no matter how fast the terminal and host can keep up. Before this, the demo ran agonizingly slow on installs that were 'less than optimal'

Caching move_yx is worth 4.2x on its own.  It rebuilds the escape
sequence from scratch on every call, and we call it for every character
on every frame.

Anchoring to wall time lets the animation run on a consistent time scale
no matter how fast the terminal and host can keep up.  Before this, a
slow setup didn't drop frames, it ran the whole demo in slow motion.
@jquast

jquast commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Thanks @btpence, this will be in next release, superseded by #404

jquast added a commit that referenced this pull request Aug 29, 2026
This is a more general-purpose version of #403 by @btpence, to improve
performance of repeated calls to jinxed.tparm, like many move_yx()
calls.

A few releases ago, we used python's curses.tparm, which was faster but
not as portable or thread-safe as our pure python tparm() in jinxed.
jquast added a commit that referenced this pull request Aug 29, 2026
This is a more general-purpose version of #403 by @btpence, to improve
performance of repeated calls to jinxed.tparm, like many move_yx()
calls.

A few releases ago, we used python's curses.tparm, which was faster but
not as portable or thread-safe as our pure python tparm() in jinxed.
jquast added a commit that referenced this pull request Aug 29, 2026
* Improved performance by caching jinxed.tparm calls

This is a more general-purpose version of #403 by @btpence, to improve
performance of repeated calls to jinxed.tparm, like many move_yx()
calls.

A few releases ago, we used python's curses.tparm, which was faster but
not as portable or thread-safe as our pure python tparm() in jinxed.
@jquast

jquast commented Aug 30, 2026

Copy link
Copy Markdown
Owner

succeeded by #404

@jquast jquast closed this Aug 30, 2026
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.

2 participants