Skip to content

[Feature] In-process actor flame-graph profiler #226

Description

@pathosDev

Size / Priority

  • Size: M

Rationale

V8's built-in profiler is general-purpose. For actor-specific tuning, a focused profiler that samples ActorCell._dispatchOne calls + reports per-actor flame-graphs is more targeted.

Design sketch

// src/profiler/ActorProfiler.ts (new)

export class ActorProfiler {
  start(): void;
  stop(): ProfilerReport;
}

export interface ProfilerReport {
  /** Per-actor handler call counts + duration histogram. */
  readonly perActor: ReadonlyMap<string, ActorProfile>;
  /** Emit a flamegraph.html file. */
  toFlamegraph(): string;
  /** Emit Chrome DevTools .cpuprofile. */
  toCpuProfile(): unknown;
}

Sample-based profiler hooks into ActorCell.onReceive timing.

Out of scope / non-goals

  • Production profiling — dev/staging only (overhead).
  • Cross-runtime profiler — Bun differs from Node.

Test plan

  1. Profile workload; report contains per-actor stats.
  2. Flame-graph file opens in browser.
  3. CPU profile loads in Chrome DevTools.

Acceptance criteria

  • ActorProfiler class.
  • Flame-graph + cpuprofile output.
  • Documentation.
  • Test suite.
  • CHANGELOG entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: lowNice-to-have / niche / demand-driven

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions