Skip to content

desktop: cut the remaining grabbed work in desktop_type preparation #266

Open

Description

@ElbertePlinio

Found while fixing #222 (PR #257).

With PR #257, an unchanged keymap is parsed and planned before the grab. Under very heavy load (15 busy loops on one CPU and host load over 70), the first grabbed attempt for text that needs a new binding still expires, and the retry succeeds. Most of the remaining grabbed cost is the verification read and parse, about 750 liveness checks, plus up to 7 single-outstanding X11 round trips of about 35 to 50 ms. Each retry also redoes hello, XKB setup, the free read, and parsing and planning on a fresh connection. In paired runs at 15 loops, the second attempt often ran out of the 3 s preparation budget before it grabbed.

Two options keep every liveness check. One is to pipeline the three keymap requests in X11Wire, which now allows one outstanding reply. The other is to reuse the previous attempt's free read for the byte comparison. Both change safety-relevant typing code and need an owner decision.

  • Decide whether either option is worth its complexity
  • Implement and measure under the same paired load

Activity

  1. added
    enhancement
    on Oct 6, 2026
  2. ElbertePlinio commented on Oct 8, 2026

    @ElbertePlinio
    MemberAuthor

    Seen again while fixing #268. Under 48 to 55 busy loops on one pinned CPU, desktop_type in desktop-input-captures-live.test.ts failed with "input not-attempted" in both the old and the fixed test, after the caret wait had passed. It failed safely: no text was sent. The limits involved are X11_SETUP_MS (3 s) and X11_GRAB_MS (250 ms) in packages/desktop-linux/src/x11-wire.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions