Token导航 LogoToken导航

Agent Skill · 研究检索

v8-jit(v8 即时)

v8-jit 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

v8-jit 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 19,185。

总安装 5,726周安装 241GitHub Stars 139,235下载 2,005核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:v8-jit(v8 即时)
来源仓库:https://github.com/vercel/next.js
仓库路径:skills/v8-jit
安装命令:
npx skills add https://github.com/vercel/next.js --skill v8-jit
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/vercel/next.js --skill v8-jit

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找和筛选相关信息。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。适合根据关键词快速定位候选结果。可结合来源仓库和 README 核验具体用法。安装前建议确认权限范围和命令执行风险。

v8-jit 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/v8-jit

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/vercel/next.js --skill v8-jit;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

v8-jit 怎么安装?

在终端执行 npx skills add https://github.com/vercel/next.js --skill v8-jit。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

v8-jit 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

v8-jit 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

v8-jit 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

v8-jit 用的人多吗?

公开数据是累计安装 5,726 次,近一周安装 241 次,下载 2,005 次,GitHub 139,235 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

v8-jit 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 139,235 星,维护活跃度相对可查。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
v8-jit

v8 即时 · 本页

5,726139,235只读未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

V8 JIT Optimization

Use this skill when writing or optimizing performance-critical code paths in Next.js server internals — especially per-request hot paths like rendering, streaming, routing, and caching.

Background: V8's Tiered Compilation

V8 compiles JavaScript through multiple tiers:

  1. Ignition (interpreter) — executes bytecode immediately.
  2. Sparkplug — fast baseline compiler (no optimization).
  3. Maglev — mid-tier optimizing compiler.
  4. Turbofan — full optimizing compiler (speculative, type-feedback-driven).

Code starts in Ignition and is promoted to higher tiers based on execution frequency and collected type feedback. Turbofan produces the fastest machine code but bails out (deopts) when assumptions are violated at runtime.

The key principle: help V8 make correct speculative assumptions by keeping types, shapes, and control flow predictable.

Hidden Classes (Shapes / Maps)

Every JavaScript object has an internal "hidden class" (V8 calls it a *Map*, the spec calls it a *Shape*). Objects that share the same property names, added in the same order, share the same hidden class. This enables fast property access via inline caches.

Initialize All Properties in Constructors

// GOOD — consistent shape, single hidden class transition chain
class RequestContext {
  url: string
  method: string
  headers: Record<string, string>
  startTime: number
  cached: boolean

  constructor(url: string, method: string, headers: Record<string, string>) {
    this.url = url
    this.method = method
    this.headers = headers
    this.startTime = performance.now()
    this.cached = false // always initialize, even defaults
  }
}
// BAD — conditional property addition creates multiple hidden classes
class RequestContext {
  constructor(url, method, headers, options) {
    this.url = url
    this.method = method
    if (options.timing) {
      this.startTime = performance.now() // shape fork!
    }
    if (options.cache) {
      this.cached = false // another shape fork!
    }
    this.headers = headers
  }
}

Rules:

  • Assign every property in the constructor, in the same order, for every instance. Use null / undefined / false as default values rather than omitting the property.
  • Prefer factory functions when constructing hot-path objects. A single factory makes it harder to accidentally fork shapes in different call sites.
  • Never delete a property on a hot object — it forces a transition to dictionary mode (slow properties).
  • Avoid adding properties after construction (obj.newProp = x) on objects used in hot paths.
  • Object literals that flow into the same function should have keys in the same order:
  • Use tuples for very small fixed-size records when names are not needed. Tuples avoid key-order pitfalls entirely.
// GOOD — same key order, shares hidden class
const a = { type: 'static', value: 1 }
const b = { type: 'dynamic', value: 2 }

// BAD — different key order, different hidden classes
const a = { type: 'static', value: 1 }
const b = { value: 2, type: 'dynamic' }

Real Codebase Example

Span in src/trace/trace.ts initializes all fields in the constructor in a fixed order — name, parentId, attrs, status, id, _start, now. This ensures all Span instances share one hidden class.

Monomorphic vs Polymorphic vs Megamorphic

V8's inline caches (ICs) track the types/shapes seen at each call site or property access:

IC StateShapes SeenSpeed
Monomorphic1Fastest — single direct check
Polymorphic2–4Fast — linear search through cases
Megamorphic5+Slow — hash-table lookup, no inlining

Once an IC goes megamorphic it does NOT recover (until the function is re-compiled). Megamorphic ICs also prevent Turbofan from inlining the function.

Keep Hot Call Sites Monomorphic

// GOOD — always called with the same argument shape
function processChunk(chunk: Uint8Array): void {
  // chunk is always Uint8Array → monomorphic
}

// BAD — called with different types at the same call site
function processChunk(chunk: Uint8Array | Buffer | string): void {
  // IC becomes polymorphic/megamorphic
}

Practical strategies:

  • Normalize inputs at the boundary (e.g. convert Buffer → Uint8Array once) and keep internal functions monomorphic.
  • Avoid passing both null and undefined for the same parameter — pick one sentinel value.
  • When a function must handle multiple types, split into separate specialized functions and dispatch once at the entry point:
// Entry point dispatches once
function handleStream(stream: ReadableStream | Readable) {
  if (stream instanceof ReadableStream) {
    return handleWebStream(stream) // monomorphic call
  }
  return handleNodeStream(stream) // monomorphic call
}

This is the pattern used in stream-ops.ts and throughout the stream-utils code (Node.js vs Web stream split via compile-time switcher).

Closure and Allocation Pressure

Every closure captures its enclosing scope. Creating closures in hot loops or per-request paths generates GC pressure and can prevent escape analysis.

Hoist Closures Out of Hot Paths

// BAD — closure allocated for every request
function handleRequest(req) {
  stream.on('data', (chunk) => processChunk(chunk, req.id))
}

// GOOD — shared listener, request context looked up by stream
const requestIdByStream = new WeakMap()
function onData(chunk) {
  const id = requestIdByStream.get(this)
  if (id !== undefined) processChunk(chunk, id)
}

function processChunk(chunk, id) {
  /* ... */
}

function handleRequest(req) {
  requestIdByStream.set(stream, req.id)
  stream.on('data', onData)
}
// BEST — pre-allocate the callback as a method on a context object
class StreamProcessor {
  id: string
  constructor(id: string) {
    this.id = id
  }
  handleChunk(chunk: Uint8Array) {
    processChunk(chunk, this.id)
  }
}

Avoid Allocations in Tight Loops

// BAD — allocates a new object per iteration
for (const item of items) {
  doSomething({ key: item.key, value: item.value })
}

// GOOD — reuse a mutable scratch object
const scratch = { key: '', value: '' }
for (const item of items) {
  scratch.key = item.key
  scratch.value = item.value
  doSomething(scratch)
}

Real Codebase Example

node-stream-helpers.ts hoists encoder, BUFFER_TAGS, and tag constants to module scope to avoid re-creating them on every request. The bufferIndexOf helper uses Buffer.indexOf (C++ native) instead of a per-call JS loop, eliminating per-chunk allocation.

Array Optimizations

V8 tracks array "element kinds" — an internal type tag that determines how elements are stored in memory:

Element KindDescriptionSpeed
PACKED_SMISmall integers only, no holesFastest
PACKED_DOUBLENumbers only, no holesFast
PACKED_ELEMENTSMixed/objects, no holesModerate
HOLEY_*Any of above with holesSlower (extra bounds check)

Transitions are one-way — once an array becomes HOLEY or PACKED_ELEMENTS, it never goes back.

Rules

  • Pre-allocate arrays with known size: new Array(n) creates a holey array. Prefer [] and push(), or use Array.from({length: n}, initFn).
  • Don't create holes: arr[100] = x on an empty array creates 100 holes.
  • Don't mix types: [1, 'two', {}] immediately becomes PACKED_ELEMENTS.
  • Prefer typed arrays only when you need binary interop/contiguous memory or have profiling evidence that they help. For small/short-lived collections, normal arrays can be faster and allocate less.
// GOOD — packed SMI array
const indices: number[] = []
for (let i = 0; i < n; i++) {
  indices.push(i)
}

// BAD — holey from the start
const indices = new Array(n)
for (let i = 0; i < n; i++) {
  indices[i] = i
}

Real Codebase Example

accumulateStreamChunks in app-render.tsx uses const staticChunks: Array<Uint8Array> = [] with push() — keeping a packed array of a single type throughout its lifetime.

Function Optimization and Deopts

Hot-Path Deopt Footguns

  • arguments object: using arguments in non-trivial ways (e.g. arguments[i] with variable i, leaking arguments). Use rest params instead.
  • Type instability at one call site: same operation sees both numbers and strings (or many object shapes) and becomes polymorphic/megamorphic.
  • eval / with: prevents optimization entirely.
  • Highly dynamic object iteration: avoid for...in on hot objects; prefer Object.keys() / Object.entries() when possible.

Favor Predictable Control Flow

// GOOD — predictable: always returns same type
function getStatus(code: number): string {
  if (code === 200) return 'ok'
  if (code === 404) return 'not found'
  return 'error'
}

// BAD — returns different types
function getStatus(code: number): string | null | undefined {
  if (code === 200) return 'ok'
  if (code === 404) return null
  // implicitly returns undefined
}

Watch Shape Diversity in switch Dispatch

// WATCH OUT — `node.type` IC can go megamorphic if many shapes hit one site
function render(node) {
  switch (node.type) {
    case 'div':
      return { tag: 'div', children: node.children }
    case 'span':
      return { tag: 'span', text: node.text }
    case 'img':
      return { src: node.src, alt: node.alt }
    // Many distinct node layouts can make this dispatch site polymorphic
  }
}

This pattern is not always bad. Often the main pressure is at the shared dispatch site (node.type), while properties used only in one branch stay monomorphic within that branch. Reach for normalization/splitting only when profiles show this site is hot and polymorphic.

String Operations

  • String concatenation in loops is usually fine in modern V8 (ropes make many concatenations cheap). For binary data, use Buffer.concat().
  • Template literals vs concatenation: equivalent performance in modern V8, but template literals are clearer.
  • string.indexOf() > regex for simple substring checks.
  • Reuse RegExp objects: don't create a new RegExp() inside a hot function — hoist it to module scope.
// GOOD — regex hoisted to module scope
const ROUTE_PATTERN = /^\/api\//

function isApiRoute(path: string): boolean {
  return ROUTE_PATTERN.test(path)
}

// BAD — regex recreated on every call
function isApiRoute(path: string): boolean {
  return /^\/api\//.test(path) // V8 may or may not cache this
}

Map and Set vs Plain Objects

  • Map is faster than plain objects for frequent additions/deletions (avoids hidden class transitions and dictionary mode).
  • Set is faster than obj[key] = true for membership checks with dynamic keys.
  • For static lookups (known keys at module load), plain objects or Object.freeze({...}) are fine — V8 optimizes them as constant.
  • Never use an object as a map if keys come from user input (prototype pollution risk + megamorphic shapes).

Profiling and Verification

V8 Flags for Diagnosing JIT Issues

# Trace which functions get optimized
node --trace-opt server.js 2>&1 | grep "my-function-name"

# Trace deoptimizations (critical for finding perf regressions)
node --trace-deopt server.js 2>&1 | grep "my-function-name"

# Combined: see the full opt/deopt lifecycle
node --trace-opt --trace-deopt server.js 2>&1 | tee /tmp/v8-trace.log

# Show IC state transitions (verbose)
node --trace-ic server.js 2>&1 | tee /tmp/ic-trace.log

# Print optimized code (advanced)
node --print-opt-code --code-comments server.js

Targeted Profiling in Next.js

# Profile a production build
node --cpu-prof --cpu-prof-dir=/tmp/profiles \
  node_modules/.bin/next build

# Profile the server during a benchmark
node --cpu-prof --cpu-prof-dir=/tmp/profiles \
  node_modules/.bin/next start &
# ... run benchmark ...
# Analyze in Chrome DevTools: chrome://inspect → Open dedicated DevTools

# Quick trace-deopt check on a specific test
node --trace-deopt $(which jest) --runInBand test/path/to/test.ts \
  2>&1 | grep -i "deopt" | head -50

Using % Natives (Development/Testing Only)

With --allow-natives-syntax:

function hotFunction(x) {
  return x + 1
}

// Force optimization
%PrepareFunctionForOptimization(hotFunction)
hotFunction(1)
hotFunction(2) % OptimizeFunctionOnNextCall(hotFunction)
hotFunction(3)

// Check optimization status
// 1 = optimized, 2 = not optimized, 3 = always optimized, 6 = maglev
console.log(%GetOptimizationStatus(hotFunction))

Checklist for Hot Path Code Reviews

  • All object properties initialized in constructor/literal, same order
  • No delete on hot objects
  • No post-construction property additions on hot objects
  • Functions receive consistent types (monomorphic call sites)
  • Type dispatch happens at boundaries, not deep in hot loops
  • No closures allocated inside tight loops
  • Module-scope constants for regex, encoders, tag buffers
  • Arrays are packed (no holes, no mixed types)
  • Map/Set used for dynamic key collections
  • No arguments object — use rest params
  • try/catch at function boundary, not inside tight loops
  • String building via array + join() or Buffer.concat()
  • Return types are consistent (no string | null | undefined mixes)

Related Skills

  • $dce-edge — DCE-safe require patterns (compile-time dead code)
  • $runtime-debug — runtime bundle debugging and profiling workflow

平台分布

Codex

36.93%
按下载量换算740

Claude

28.34%
按下载量换算568

Cursor

19.18%
按下载量换算385

Gemini CLI

10.43%
按下载量换算209

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills