Works with the AI Agents you already use

    JS V8 Speedup: Profile, Fix, Prove (Node.js)

    by Firt

    1

    Make slow Node.js code measurably faster with V8 profiling, and prove the output is identical.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    JS V8 Speedup: Profile, Fix, Prove (Node.js)

    JS V8 Speedup: Profile, Fix, Prove (Node.js)

    Example session with this skill installed

    Our log report job is slow. old.mjs (default export aggregate(text)) aggregates the access log input.log (60,000 lines, 5.6 MB): per endpoint count, 5xx errors, p95 latency, unique IPs, plus the 5 busiest UTC hours. Please make it as fast as you can WITHOUT changing its output, and give me a short before/after report.

    • Read your context and instructions
    • Compiled the js v8 speedup

    Before: 4742 ms After: 163 ms Speedup: ~29x (60,000 lines, 15 runs, warmup 5). At 1/4 size: 344 → 47 ms (7.3x) — old code is quadratic, so the gain grows with log size. Noise A-vs-A 0.89x; machine busy, numbers indicative.
    Output identical: YES (deep-equal + same errors on both sizes; 2 × 3,000 fuzzed logs, 0 different; 93 edge cases, 0 different).
    What changed (biggest first):

    1. Latencies sorted once per endpoint at the end instead of after every line; unique IPs in a Set instead of indexOf on a growing array; regex hoisted out of the loop. Evidence: profile showed aggregate 74% + sort comparator 16.5% self. Gain 18.9x.
    2. Second pass: timestamp → UTC hour by integer arithmetic for the standard log format only; anything unusual falls back to the original Date path, so behaviour is unchanged. Normalised path cached per URL. Gains 1.58x and 1.31x.
    3. Smaller: no per-line key strings, month by char codes, Float64Array sort for p95. Gain 1.08x.
      Tried and reverted: hand-written line scanner (0.99x, no gain, more code).
      The fuzz check caught a real month-offset bug in the first fast-path attempt before anything was reported.
      Independent re-check in a separate process: 4830 → 167 ms, 29.0x, output identical.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    "Optimize this" often means guesswork: a few rewrites, one lucky timing, a quiet behaviour change. This skill makes your agent profile first and prove the result.

    Built for JavaScript/TypeScript on Node.js (V8), not generic multi-language advice:

    • Profiles with node --cpu-prof and summarizes self time with an included script. It warns when built-ins (sort, indexOf, RegExp, Date) are billed to the caller and times sub-steps instead of guessing.
    • Finds deoptimizations with --trace-deopt: unstable hidden classes, megamorphic call sites, mixed return types, holey arrays.
    • Fixes in order of payoff: hidden O(n²) (includes/indexOf/re-sort in loops), per-item regex and key work, spread copies and split() allocations, then V8 specifics (stable object shapes, monomorphic functions, dense arrays, string building).
    • Second pass: re-profiles and adds exact-fallback fast paths (e.g. timestamp arithmetic, original parser for anything unusual).

    Proof, not claims. Included scripts:

    • abbench.mjs: interleaved A/B benchmark with warmup and median, plus a deep-equality check (-0, NaN, prototypes) and same-error-on-throw check.
    • fuzzeq.mjs: mutates your real input (bad characters, truncation, CRLF, blank lines) and requires 0 differences between old and new.
    • runloop.mjs + hotspots.mjs: a profiling harness and a .cpuprofile summary.

    Tested on two realistic slow programs (a CSV order parser and an access-log aggregator). Agents using the skill got 12.7x and ~18–29x median speedups, with outputs identical on deep-equal, 3,000+ fuzz cases and edge tests, checked again independently. Reports list before/after medians, noise, each change with evidence and gain, and what was reverted.

    Honest limits: Node/V8 only. If the bottleneck is the database, network or disk, it says so instead of tuning loops. No dropped validation or new dependencies without asking. Numbers on a busy machine are reported as ranges.

    Works with any SKILL.md agent (Claude Code, Cursor, Codex).

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 16 days ago

    Permissions

    Write Files
    Listed16 days ago

    What's inside

    Frequently Asked Questions

    Make slow Node.js code measurably faster with V8 profiling, and prove the output is identical.

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use JS V8 Speedup: Profile, Fix, Prove (Node.js) on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    New in Code Quality & Review

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.