Skip to content

Optimize blocking hot path and storage inefficiencies#87

Draft
ACK-J wants to merge 1 commit into
mainfrom
cursor/perf-hotpath-optimizations-9ec5
Draft

Optimize blocking hot path and storage inefficiencies#87
ACK-J wants to merge 1 commit into
mainfrom
cursor/perf-hotpath-optimizations-9ec5

Conversation

@ACK-J

@ACK-J ACK-J commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Addresses the efficiency review items #2, #3, #5#7 and mediums #8#12 (DNS / Selective Allow double-work left alone).

Changes

  • Sync webRequest fast-pathevaluateRequestSync returns a plain { cancel } when DNS is not needed; background peeks the warm compiled allowlist and avoids Promise scheduling on first-party / allowlisted / literal-local / known-TMX hits.
  • Compiled allowlistcompileAllowlist() preclassifies exact hosts, portless IPs, and CIDRs (with masks) so matching is Set/integer checks instead of per-request URL + CIDR reparsing.
  • Popup single fetch — one getTabActivity round-trip populates both blocked ports and hosts.
  • Dirty activity persistence — skip storage writes when nothing changed; replace structuredClone with targeted Set→array snapshots.
  • Native storage values — stop double-JSON.stringify; legacy string cells still decode on read.
  • Mediums — Sets for port/host membership; normalize hostname once in the filter; cheaper IPv6 literal gate; suffix-list rebinding helpers; pass originHost into notifications.

Tests

npm test679 passed.

Out of scope

DNS-on-every-third-party-host (#1) and Selective Allow double-parse / uncached cross-origin list (#4).

Open in Web Open in Cursor 

Compile allowlists into Sets/CIDRs, return sync webRequest decisions when
DNS is unnecessary, skip clean activity flushes, store native values, and
cut redundant popup/hostname work on the blocking path.

Co-authored-by: Hacks and Hops <ACK-J@users.noreply.github.com>
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.

2 participants