Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 26, 2025

Addresses performance bottlenecks in the proxy backend through caching, reduced redundant operations, and improved data structures. Also implements the experimental preconfigured sites and dynamic loading features.

Backend Server (server/index.ts)

  • Add routing cache with iterator-based eviction to skip redundant bareServer.shouldRoute() calls
  • Enable static file caching with 1-day max-age and precompressed file support
  • Increase highWaterMark to 64KB for better throughput
  • Suppress verbose logging in production

Service Worker (public/sw.js)

  • Replace Array.some() with Set for O(1) domain lookups on CAPTCHA/heavy-cookie domains
  • Cache route decisions with 30s TTL
  • Load scramjet config once per SW lifecycle instead of every fetch
  • Precompile regex patterns for HTML injection

Proxy Utilities (src/utils/proxy.ts)

  • Cache URL encodings and transport settings with TTL
  • Prevent duplicate script loading
  • Integrate experimental features via encodeURLWithExperiments()

New: Experimental Features (src/utils/experimental.ts)

  • Preconfigured sites database (20+ sites with optimal proxy/transport combos)
  • Dynamic loading handler that detects errors and cycles through fallback configurations
// Example: Amazon uses Scramjet + Bare for cookie handling
const PRECONFIGURED_SITES = {
  "amazon.com": { proxy: "sj", routingMode: "bare", reason: "Complex cookie handling" },
  "youtube.com": { proxy: "uv", routingMode: "wisp", transport: "libcurl" },
  // ...
};

Storage & Captcha Handler

  • Add in-memory cache with batch eviction (10-20% per eviction cycle)
  • Use requestIdleCallback for batched DOM mutations
  • Prevent duplicate initialization

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/Radius/Radius/node_modules/.bin/astro build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

optomize the backend proxy and fetures for speed, and stability on the back end to inprove site loading and reduce repetitive processes to decreace load time while maintiang all of the current fetures. also inprove the experemantal fetures


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@codesandbox
Copy link

codesandbox bot commented Nov 26, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copilot AI and others added 2 commits November 26, 2025 23:31
…features

Co-authored-by: sriail <225764385+sriail@users.noreply.github.com>
Co-authored-by: sriail <225764385+sriail@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize backend proxy for speed and stability Optimize backend proxy for speed and stability, improve experimental features Nov 26, 2025
Copilot AI requested a review from sriail November 26, 2025 23:42
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