v8-deopt-generate-log

Generate a V8 log given a JS or HTML file

Usage no npm install needed!

<script type="module">
  import v8DeoptGenerateLog from 'https://cdn.skypack.dev/v8-deopt-generate-log';
</script>

README

v8-deopt-generate-log

Given a JavaScript file or URL, run the file or webpage and save a log of V8 optimizations and deoptimizations.

Installation

Check out v8-deopt-viewer for a CLI that automates this for you!

Requires NodeJS 14.x or greater.

npm i v8-deopt-generate-log

Also install puppeteer if you plan to generate logs for URLs or HTML files:

npm i puppeteer

Usage

See index.d.ts for the latest API. A snapshot is below.

interface Options {
    /** Path to store the V8 log file. Defaults to your OS temporary directory */
    logFilePath?: string;

    /**
     * How long the keep the browser open to allow the webpage to run before
     * closing the browser
     */
    browserTimeoutMs?: number;
}

/**
 * Generate a V8 log of optimizations and deoptimizations for the given JS or
 * HTML file
 * @param srcPath The path or URL to run
 * @param options Options to influence how the log is generated
 * @returns The path to the generated V8 log file
 */
export async function generateV8Log(
    srcPath: string,
    options?: Options
): Promise<string>;