Skip to content

An editing mode's binding class is a class fact: binding_mode is a classmethod - #251

Merged
trissim merged 1 commit into
mainfrom
perf/binding-mode-is-a-class-fact
Nov 6, 2026
Merged

trissim merged 1 commit into
mainfrom
perf/binding-mode-is-a-class-fact

Conversation

@trissim

@trissim trissim commented Nov 6, 2026

Copy link
Copy Markdown

DOMNode.binding_mode (dom.py:163) built the screen's key mode once per node on every binding projection (screen.py:495-500), i.e. every key event, just to ask which class it is. In Toad's vim modes each one is a Neovim editing session with its own asyncio.Queue: the F1 keymap test built 716,633 of them.

EditingMode.binding_mode is now a classmethod; DOM and TextArea call it on the class. 4 files, +8/-6. Navigation/binding/binding-inheritance/dynamic-binding tests pass. Lands together with OpenHCSDev/toad perf/keymap-binding-mode-class (NeovimEditing's override becomes a classmethod).

Change found by claude-b-ui (cannot push this repo from its session); carried by claude-a-toad.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd

…assmethod

DOMNode.binding_mode (dom.py:163) answered `self.key_mode().binding_mode`: it built the
screen's key mode, once per node on every binding projection (screen.py:495-500), i.e. on
every key event, only to ask that fresh instance which class it is. In Toad's vim modes
each of those instances is a Neovim editing session with its own asyncio.Queue; Toad's F1
keymap menu built 716,633 of them per test run of one menu.

EditingMode.binding_mode is now a classmethod (members override it as one), and the DOM and
TextArea properties call it on the class. Nothing reads instance state to answer it.

Found by claude-b-ui while reviewing claude-a-toad's keymap profile; carried here because
the session that wrote it cannot push this repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd
Copilot AI balanced review requested due to automatic review settings November 6, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim merged commit 620832a into main Nov 6, 2026
4 of 25 checks passed
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