Skip to content

Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.

Make the scale benchmarks opt-in, and correct the performance docs

Bee84b654b618d4
diff --git a/core/nectarlink-core/tests/scale_tests.rs b/core/nectarlink-core/tests/scale_tests.rs
index e564ce4..cb7e5f6 100644
--- a/core/nectarlink-core/tests/scale_tests.rs
+++ b/core/nectarlink-core/tests/scale_tests.rs
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: MPL-2.0
-//! Section 3.3 Scale & Performance verification suite and P2 core feature tests
-//! (`wake.relay` and `audio.pcm`).
+//! Scale and performance checks, and the relayed wake and PC audio round trip.
+//!
+//! The scale checks move gigabytes and hold timing limits, so they depend on
+//! the machine and are opt-in:
+//! `cargo test -p nectarlink-core --release --test scale_tests -- --ignored`.
use std::{
io::{Read, Write},
@@ -122,6 +125,7 @@ async fn relayed_wake_and_pc_audio_pcm_roundtrip() {
pc.shutdown().await;
}
+#[ignore = "scale benchmark with timing limits; run with --ignored"]
#[tokio::test(flavor = "multi_thread")]
async fn scale_10000_notifications_in_history_and_search() {
let dir = TempDir::new().expect("temp dir");
@@ -194,6 +198,7 @@ async fn scale_10000_notifications_in_history_and_search() {
node.shutdown().await;
}
+#[ignore = "scale benchmark with timing limits; run with --ignored"]
#[tokio::test(flavor = "multi_thread")]
async fn scale_5000_timeline_entries_and_200_chat_threads() {
let dir = TempDir::new().expect("temp dir");
@@ -332,6 +337,7 @@ async fn scale_5000_timeline_entries_and_200_chat_threads() {
node.shutdown().await;
}
+#[ignore = "scale benchmark with timing limits; run with --ignored"]
#[test]
fn scale_50_large_clips_encrypted_history() {
let dir = TempDir::new().expect("temp dir");
@@ -387,6 +393,7 @@ fn scale_50_large_clips_encrypted_history() {
);
}
+#[ignore = "scale benchmark with timing limits; run with --ignored"]
#[tokio::test(flavor = "multi_thread")]
async fn scale_4gb_file_transfer_with_pause_resume_interruption_and_blake3() {
const FOUR_GIB: u64 = 4 * 1024 * 1024 * 1024; // 4,294,967,296 bytes
diff --git a/docs/PERFORMANCE.md b/docs/PERFORMANCE.md
index 471f64a..61b3713 100644
--- a/docs/PERFORMANCE.md
+++ b/docs/PERFORMANCE.md
@@ -15,11 +15,10 @@ This document records the release performance budgets, root-cause regression aud
| **Desktop Working Set Memory (Window Closed / Tray)** | `< 50 MB` | **`14.2 MB`** private working set (`WorkingSet64`) | **PASS** |
| **Desktop Working Set Memory (Window Open, Glass + Island)** | `< 170 MB` | **`165.32 MB` WS / `137.34 MB` Private** (down from `205.36 MB` WS / `174.58 MB` Private) | **PASS** |
| **Desktop 20-Step Window Resize CPU** | `< 350 ms` CPU | **`296.9 ms` CPU (`635 ms` wall)** (down from `421.9 ms` CPU; `-29.6%` CPU, `0` QML binding loops) | **PASS** |
-| **Command Palette (`Ctrl+K`) Open Time** | `< 30 ms` | **`8.4 ms`** (popup open + initial action list filter) | **PASS** |
+| **Command Palette (`Ctrl+Alt+Space`) Open Time** | `< 30 ms` | **`8.4 ms`** (popup open + initial action list filter) | **PASS** |
| **Screen Mirror End-to-End Latency (USB / LAN)** | `< 45 ms` | **`22 ms to 31 ms`** (`60 fps` H.264 hardware encode/decode over QUIC) | **PASS** |
| **PC-to-Phone Speaker Audio Latency (`PcAudio`)** | `< 40 ms` | **`22 ms to 36 ms`** (10 ms WASAPI loopback chunk + QUIC stream + `AudioTrack` `PERFORMANCE_MODE_LOW_LATENCY`) | **PASS** |
-| **File Transfer Throughput (Emulator USB/Loopback Link)** | `> 80 MB/s` | **`215 MB/s`** (streaming QUIC + BLAKE3 incremental hashing) | **PASS** |
-| **4 GB Sparse File Transfer + Pause/Resume + BLAKE3** | `< 5 s` in test | **`1.42 s`** end-to-end with mid-stream pause, `.part` offset resume, and full BLAKE3 verification | **PASS** |
+| **4 GiB File Transfer + Pause/Resume + BLAKE3** | `< 180 s` in test | **`16.0 s`** transfer with two mid-stream pauses and `.part` offset resumes, then **`1.74 s`** full BLAKE3 verification (release build) | **PASS** |
| **Android Cold Start (`MainActivity`)** | `< 1,000 ms` | **`479 ms to 750 ms`** (`TotalTime` via `am start -W`, down from `1,566 ms to 2,291 ms`) | **PASS** |
| **Android Warm Start (`MainActivity`)** | `< 100 ms` | **`14 ms to 30 ms`** (`WaitTime` via `am start -W`, down from `81 ms to 91 ms`) | **PASS** |
| **Android Memory (`dumpsys meminfo app.nectarlink`)** | `< 110 MB` PSS | **`75.66 MB to 86.48 MB` PSS (`228.0 MB to 236.8 MB` RSS)** (down from `115.9 MB to 123.5 MB` PSS) | **PASS** |
@@ -105,37 +104,19 @@ Measured over a 10-second steady-state window on 12 logical cores (`release` bui
---
-## 3. Scale Benchmark Measurements (`core/nectarlink-core/tests/scale.rs`)
+## 3. Scale Benchmark Measurements (`core/nectarlink-core/tests/scale_tests.rs`)
-Executed via `cargo test -p nectarlink-core --test scale -- --nocapture`:
+The scale benchmarks move gigabytes and hold timing limits, so they are opt-in. Measured with a release build on Windows 11 x64 on 2026-10-14:
-1. **10,000 Notifications in History (`scale_10000_notifications_in_history`)**
- - Ingesting 10,000 notifications takes **`18.4 ms`** total; active list is bounded to `MAX_NOTIFICATIONS = 200` (`O(1)` memory footprint) with instant dismiss/clear.
-2. **5,000 Timeline Entries (`scale_5000_timeline_entries_insert_and_query`)**
- - Indexed SQLite storage (`idx_timeline_updated`); full-text search + kind filter across 5,000 persisted entries completes in **`3.1 ms`**, and page-size-100 cursor queries complete in **`< 0.8 ms`**.
-3. **50 Large Clipboard Clips (`scale_50_large_clips_history`)**
- - Storing and querying 50 × 256 KB rich clipboard items (12.8 MB total payload) with SHA-256 deduplication and full-text search completes in **`4.2 ms`** query time.
-4. **4 GB File Transfer with Pause, Resume & BLAKE3 (`four_gigabyte_transfer_with_pause_resume_and_blake3_check`)**
- - Streams a 4 GiB (`4,294,967,296` byte) sparse file over QUIC, pauses after >64 MiB, resumes from the exact `.part` byte offset, and verifies the full 4 GiB BLAKE3 digest in **`1.42 s`** with bounded `< 16 MB` buffer memory.
-5. **200 SMS Chat Threads (`scale_200_chat_threads_sorting_and_lookup`)**
- - Conversation sorting, unread badge aggregation, and message lookup across 200 threads (`10,000` messages) completes in **`1.9 ms`**.
-6. **10,000 Photos in Gallery (`scale_10000_photos_gallery_listing`)**
- - Paged gallery indexing and date-descending slice retrieval across 10,000 photo items completes in **`2.4 ms`**.
+```powershell
+cargo test -p nectarlink-core --release --test scale_tests -- --ignored --nocapture
+```
----
-
-## 4. Soak & Stability Verification (`scripts/soak-test.ps1`)
-
-Executed against `nectarlink-desktop.exe --data-dir <test-data-dir> --minimized` paired with an Android emulator over ADB USB/LAN transport with periodic clipboard, notification, battery/signal, and file-transfer activity:
-
-| Sample | Elapsed | Desktop Working Set (`MB`) | Desktop Handle Count | Desktop CPU (`%`) | Emulator RSS (`MB`) | Reconnect Storms |
-| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
-| **Sample 1 (Baseline)** | `T+0m` | `14.18 MB` | `462` | `0.00%` | `118 MB` | `0` |
-| **Sample 2 (Active Cycle)** | `T+30m eq.` | `14.24 MB` | `465` | `0.00%` | `120 MB` | `0` |
-| **Sample 3 (Mid Soak)** | `T+60m eq.` | `14.21 MB` | `464` | `0.00%` | `119 MB` | `0` |
-| **Sample 4 (Late Soak)** | `T+90m eq.` | `14.22 MB` | `464` | `0.00%` | `120 MB` | `0` |
-| **Sample 5 (Final)** | `T+120m eq.` | `14.20 MB` | `464` | `0.00%` | `119 MB` | `0` |
-
-- **Memory growth:** `< 0.1 MB` net change after GC/allocator steady state (no memory leaks).
-- **Handle growth:** `+2` handles from initial baseline, stabilizing at `464` (no handle leaks).
-- **Audio & Webcam Soak:** Continuous WASAPI `PcAudio` streaming (10 ms PCM chunks) and `GlSurfacePipe` H.264 webcam streaming (`1280×720 @ 30 fps`) run with zero buffer underruns or surface leaks (`PcSpeakerPlayer` bounds `AudioTrack` queue lag to `< 40 ms` via `maxQueuedBytes`).
+1. **4 GiB file transfer with pause, resume and BLAKE3 (`scale_4gb_file_transfer_with_pause_resume_interruption_and_blake3`)**
+ - Streams a 4 GiB (`4,294,967,296` byte) file between two paired nodes over QUIC, pauses twice mid-stream (at 65 MiB and 102 MiB), resumes from the `.part` byte offset each time, and verifies the full BLAKE3 digest. Transfer: **`16.0 s`**; verification: **`1.74 s`**. Limit in the test: `180 s`.
+2. **10,000 notifications (`scale_10000_notifications_in_history_and_search`)**
+ - Ingest: **`13.8 ms`**. Listing a 200-item page: **`0.15 ms`**; search: **`2.43 ms`**. Limit: `100 ms` for list and search together.
+3. **5,000 timeline entries and 200 chat threads (`scale_5000_timeline_entries_and_200_chat_threads`)**
+ - Insert: **`442 ms`** (timeline), **`105 ms`** (chats). Page query: **`0.89 ms`**; search: **`4.60 ms`**; thread list: **`0.37 ms`**; messages: **`0.06 ms`**. Limits: `50 ms` per query, `100 ms` for search.
+4. **50 clipboard items of 64 KiB, encrypted (`scale_50_large_clips_encrypted_history`)**
+ - Writing all 50 with DPAPI encryption: **`3.06 s`**. Reopening, decrypting, listing and searching: **`182 ms`**. Limit: `250 ms` in release builds.
diff --git a/docs/technical/building-and-testing.md b/docs/technical/building-and-testing.md
index 30960ab..21d021e 100644
--- a/docs/technical/building-and-testing.md
+++ b/docs/technical/building-and-testing.md
@@ -143,11 +143,11 @@ cargo test -p nectarlink-protocol
# Core unit tests (SQLite store v7, send_queue FIFO/TTL/replacement, ADB/USB tunnel, OKLab palette, clipboard vault)
cargo test -p nectarlink-core --lib
-# End-to-end two-device QUIC integration tests (pairing, capabilities, 100 MiB transfer, pause/resume)
+# End-to-end two-device QUIC integration tests (pairing, capabilities, transfers, pause/resume)
cargo test -p nectarlink-core --test two_devices
-# High-scale stress tests (4 GiB transfer, 10k files, 50k timeline rows, 10k contacts, 5k photos)
-cargo test -p nectarlink-core --release --test scale_tests
+# Scale benchmarks, opt-in (4 GiB transfer, 10,000 notifications, 5,000 timeline entries, encrypted clipboard history)
+cargo test -p nectarlink-core --release --test scale_tests -- --ignored
# UniFFI binding round-trip tests
cargo test -p nectarlink-ffi
diff --git a/docs/technical/performance-budgets.md b/docs/technical/performance-budgets.md
index 2f008dc..dd5ff35 100644
--- a/docs/technical/performance-budgets.md
+++ b/docs/technical/performance-budgets.md
@@ -19,17 +19,20 @@ Nectarlink treats startup latency, idle resource consumption, UI frame pacing, a
| Phone-to-PC screen mirror glass-to-glass latency | `< 45 ms` | **`22 ms - 31 ms`** (`60 fps` 1080p H.264) | High-speed camera timestamp delta over LAN/USB |
| PC-to-phone audio streaming latency | `< 40 ms` | **`22 ms - 36 ms`** (`48 kHz` stereo) | WASAPI loopback capture → `NLPA` QUIC datagrams → Android `AudioTrack` |
-### Transport and Scale Benchmarks (`nectarlink-core`)
+### Scale Benchmarks (`nectarlink-core`)
-| Metric | Budget | Measured | Verification Method |
-|---|---|---|---|
-| Bulk file transfer throughput (100 MiB) | `> 80 MB/s` | **`215 MB/s`** (`0.46 s` for 100 MiB) | `cargo test -p nectarlink-core --release --test two_devices file_transfer_100mb_throughput` |
-| 4 GiB transfer + mid-stream pause/resume + BLAKE3 | `< 5.0 s` | **`1.42 s`** | `cargo test -p nectarlink-core --release --test scale_tests scale_4gb_transfer_pause_resume` |
-| 10,000-file directory batch transfer | `< 30 s` | **`2.19 s`** | `cargo test -p nectarlink-core --release --test scale_tests scale_10k_small_files_batch` |
-| 50,000-entry SQLite timeline insert + query + search | `< 500 ms` query | **`817 ms`** insert / **`0.46 ms`** page query / **`15.42 ms`** substring search | `cargo test -p nectarlink-core --release --test scale_tests scale_50k_timeline_entries` |
-| 10,000-contact synchronization + lookup | `< 5.0 s` | **`0.55 s`** | `cargo test -p nectarlink-core --release --test scale_tests scale_10k_contacts_sync` |
-| 5,000-photo gallery index + pagination | `< 2.0 s` | **`0.18 s`** | `cargo test -p nectarlink-core --release --test scale_tests scale_5k_photos_pagination` |
-| 2-hour continuous multi-feature soak test | `0` disconnects, `< 5 MB` RSS delta | **`0` disconnects**, **`+1.8 MB`** RSS delta | Continuous notifications, clipboard, media state, and periodic file transfers |
+The scale benchmarks move gigabytes of data and hold timing limits, so they are opt-in rather than part of every CI run. Measured with a release build on Windows 11 x64 (DPAPI key protection) on 2026-10-14:
+
+```powershell
+cargo test -p nectarlink-core --release --test scale_tests -- --ignored --nocapture
+```
+
+| Benchmark (`tests/scale_tests.rs`) | Limit in the test | Measured |
+|---|---|---|
+| `scale_4gb_file_transfer_with_pause_resume_interruption_and_blake3`: a 4 GiB file between two paired nodes, paused and resumed twice mid-stream, then BLAKE3 verified | Transfer `< 180 s` | **`16.0 s`** transfer, **`1.74 s`** BLAKE3 verify |
+| `scale_10000_notifications_in_history_and_search`: 10,000 notifications ingested, a 200-item page listed and searched | List and search `< 100 ms` | **`13.8 ms`** ingest, **`0.15 ms`** list, **`2.43 ms`** search |
+| `scale_5000_timeline_entries_and_200_chat_threads`: 5,000 timeline entries and 200 chat threads | Page and thread queries `< 50 ms`, search `< 100 ms` | **`0.89 ms`** page, **`4.60 ms`** search, **`0.37 ms`** threads, **`0.06 ms`** messages |
+| `scale_50_large_clips_encrypted_history`: 50 clipboard items of 64 KiB each, encrypted at rest | Reopen, decrypt, list and search `< 250 ms` (release) | **`3.06 s`** to write all 50, **`182 ms`** to reopen and search |
### Android Client (`app.nectarlink.android`)