function

jsc.bytecodeOrderStats

For an executable built with bun build --compile --bytecode --bytecode-order: how many functions this thread has loaded from each part of the bytecode the order file arranged. Returns null in any other process. See BytecodeOrderStats.

import { bytecodeOrderStats } from "bun:jsc";

const stats = bytecodeOrderStats();
if (stats) console.log(stats.cold / (stats.hot + stats.unknown + stats.cold));

Referenced types

interface BytecodeOrderStats

Returned by bytecodeOrderStats. Counts are per thread: a Worker has its own. A function whose bytecode was discarded and loaded again counts again. Sizes are in bytes.

  • cold: number

    Functions loaded that the order file's run had not used.

  • coldBytes: number
  • hot: number

    Functions loaded that the order file's run had used.

  • hotBytes: number
  • regions: { cold: number; expressionInfo: number; hot: number; lateModuleHeads: number; moduleHeads: number; unknown: number }

    The size of each part of the bytecode, in the order they are stored.

  • unknown: number

    Functions loaded that the build the order file was recorded from did not have.

  • unknownBytes: number