Skip to content

perf: fix N+1 IPC, SQLite WAL, batch settings - v3.1.0 - #9

Merged
Bulletdev merged 1 commit into
masterfrom
fix/perf-and-functional-wiring
Nov 24, 2026
Merged

Bulletdev merged 1 commit into
masterfrom
fix/perf-and-functional-wiring

Conversation

@Bulletdev

Copy link
Copy Markdown
Owner

Summary

  • SQLite WAL mode + synchronous=NORMAL + busy_timeout=5000 on init - eliminates ~10-50ms fsync per write that was causing noticeable UI lag on every toggle/setting change
  • get_all_settings batch command - replaces 11 sequential Tauri IPC round-trips (one per setting key) with a single call on app startup
  • set_settings_batch with SQLite transaction - wraps content blocker saves (6 writes) in one transaction instead of 6 individual commits
  • Parallel profile ping - Promise.all instead of sequential for...of await loop
  • Version bump 3.0.0 -> 3.1.0

Root cause

Every invoke("set_setting") triggered a separate SQLite write with PRAGMA synchronous=FULL (default), causing a full disk fsync (~10-50ms). With 11 settings loaded sequentially on startup and 6 written per blocker save, the cumulative delay was noticeable. Language/theme changes triggered re-renders that cascaded into these slow paths.

Test plan

  • Toggle content blockers rapidly - should feel instant
  • Change language - no visible delay
  • App startup - settings load in one batch
  • Profile ping latency shows for all profiles simultaneously

Performance:
- Add PRAGMA journal_mode=WAL + synchronous=NORMAL + busy_timeout
  to SQLite init - eliminates fsync per write (~10-50ms each)
- Add get_all_settings command - replaces 11 sequential IPC calls
  with a single batch read on app startup
- Add set_settings_batch on db.rs - wraps multiple writes in a
  single SQLite transaction (used by save_blocker_settings)
- Parallelize profile ping with Promise.all instead of sequential
  await loop

Version bump to 3.1.0
@Bulletdev Bulletdev self-assigned this Nov 24, 2026
@Bulletdev
Bulletdev merged commit 5e5d0b6 into master Nov 24, 2026
5 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