Skip to content

Serialize graph-batch on the walker thread, not the UI thread #86

Description

@zangjiucheng

The app's hottest IPC stream serializes on the main thread. commands.rs:293 calls event_util::emit_on_main, whose closure at event_util.rs:31-36 runs handle.emit on the main thread; tauri 2.11.5's emit wraps the payload as EmitPayload::Serialize and serializes downstream in EmitArgs::new.

Honest scale

typical batch (1000 rows / 5k gaps) 0.22 ms
worst case (MAX_GAP_SEGMENTS_PER_BATCH = 200_000, commands.rs:113) 2.7 ms

against an 8 ms throttle floor.

So this is worth doing because the walker thread is idle anyway and the change is small — not because it is a large main-thread stall. Sizing it honestly matters more than shipping it.

Ride-along

Fix the stale doc at event_util.rs:11,21-22, which still claims graph-batch uses an ipc::Channel. It does not — that approach was abandoned because it broke multi-window and second-instance handling.

Sequencing

Land after the wide-branching perf test, so it goes in under a regression guard.

Land after #84 so it goes in under a regression guard.


Found during v1.3.0 research: parallel codebase surveys, then each finding independently verified against the code before filing. Line numbers are from dev at the time of writing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceSpeed, memory, or startup cost

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions