Skip to content

Reduce native server memory and background work across platforms - #4

Merged
FedyaLight merged 1 commit into
mainfrom
perf/native-resource-efficiency
Oct 11, 2026
Merged

FedyaLight merged 1 commit into
mainfrom
perf/native-resource-efficiency

Conversation

@FedyaLight

Copy link
Copy Markdown
Owner

Large asset responses in the Windows/Linux server currently read the entire file and copy its requested slice. Four slow downloads of a 64 MiB stress asset retained about 393 MiB RSS in the debug relay. Streaming the requested bytes in bounded 64 KiB chunks reduced the measured peak to about 12.5 MiB on the same host, without changing HTTP headers or delivered bytes.

Also removes cancelled Android socket-watchdog tasks immediately, caches the desktop translation catalogue, forwards minimized/restored desktop visibility to the shared renderer, and suppresses duplicate macOS speech-state IPC. Socket timeouts, queue bounds, microphone/transcript quality, reconnect and ordinary visible-window behavior remain intact. No dependencies are added.

The lifecycle/resource audit and measurement limits are recorded in docs/native-resource-audit.md.

Validation:

  • The macOS app builds with the existing script/build_and_run.sh --build.
  • The full Tauri shell passes cargo check --locked on macOS; the production Rust server harness builds and runs.
  • tests/relay.mjs passes against the original and changed Rust relays: exact payloads, no echo, fragmented UTF-8, shared native session, HTTP cache/HEAD, asset bytes and supported Range forms.
  • A separate patterned 64 MiB asset verifies a range crossing the streaming chunk boundary, alongside the four slow-download memory sample.
  • Formatting and whitespace checks pass.

The repository CI supplies Windows, Linux x64/ARM64 and Android release/lint builds. Native minimize/restore and actual device battery use still need physical/VM checks; the memory sample is a debug process measurement with an intentionally oversized fixture, not a claim about every platform or normal font downloads.

@FedyaLight
FedyaLight merged commit a1a9b06 into main Oct 11, 2026
10 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.

1 participant