Skip to content

Startup regression: ~1.4s delay in v0.1.0-alpha.21 due to terminal probing #177

@tensor-r

Description

@tensor-r

Summary

After upgrading from v0.1.0-alpha.20 to v0.1.0-alpha.21, the app now takes ~1.4 seconds before rendering the first frame. On v0.1.0-alpha.20 it was immediate.

Observed behavior

  • alpha.20: First frame renders instantly. Streaming data appears as 1/1 on the first frame.
  • alpha.21: First frame renders after ~1.4s. By then, streaming data has already buffered — the first frame shows 1/14 (14 entries accumulated during the delay), confirming the app was several frames behind.

This happens both with piped stdin and with static file input.

Likely cause

v0.1.0-alpha.21 includes a new terminal capability detection system (zr_detect.c, added in ae6fdfb) that sends DA1/DA2/XTVERSION escape sequences at engine startup and waits up to 500ms for responses (ZR_DETECT_TOTAL_TIMEOUT_MS = 500).

Additionally, createApp.ts now awaits loadTerminalProfile(backend) after backend.start() resolves, adding an async round-trip to the worker before the first render.

Request

Could there be a way to opt out of terminal probing at startup (e.g. createNodeBackend({ skipDetect: true })) for apps that don't use graphics features? Or could the profile detection be deferred so the first frame renders immediately while probing happens in the background?

Environment

  • Runtime: Bun 1.3.9
  • OS: Linux 6.17.0-14-generic
  • Terminal: Ghostty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions