import { SchemaIR } from "../types.js"; import { CodeGenContext } from "./context.js"; //#region src/core/codegen/fast-size.d.ts /** * Per-function soft size cap, in emitted characters. Once the fast-check being * assembled would exceed this, the next large hoistable sub-schema is split into * its own helper. Set below the ~60KB bytecode point where TurboFan bails (chars * over-approximate bytecode) with margin for one look-ahead mis-prediction. */ declare const EXTRACT_CAP = 38000; /** * Predicted emitted size of inlining `ir` at a call site whose input expression * is `inputLen` chars long — the path-agnostic subtree estimate scaled up for * the access-path prefix that estimate omits. Used only for the extract/inline * decision; the running total uses exact emitted lengths. */ declare function predictedInlineSize(ir: SchemaIR, inputLen: number, cache: WeakMap): number; /** * Floor for extraction: never hoist a sub-schema smaller than this even when * the enclosing function is over the cap — a tiny helper trades a real call for * no optimization benefit. Only sub-schemas big enough to matter are split. */ declare const MIN_EXTRACT = 1200; /** Approximate size contributed to the enclosing function by an extracted call `__fo_N(expr)`. */ declare const CALL_COST = 24; /** * Node types whose fast-check is a self-contained boolean over a single input * expression and large enough to be worth hoisting into `function f(p){return …}`. * Thin wrappers (optional/nullable/default/…) are omitted: their inner schema is * visited through `generateFast` and gets hoisted on its own when large. */ declare const HOISTABLE: ReadonlySet; /** * Estimated total size of a node's fast-check (the node plus everything inlined * beneath it). Memoized per IR node: schemas dedupe shared sub-trees and the * estimate is consulted at every nesting level, so without the cache a deep tree * would be re-walked quadratically. */ declare function estimateFastCost(ir: SchemaIR, cache: WeakMap): number; /** * Sort a fast-check's sibling conjuncts (or union options) cheapest-first. * Returns a new array; ties keep source order (Array#sort is stable), so a * schema whose members all cost the same emits byte-identical output. */ declare function orderByRuntimeCost(items: readonly T[], irOf: (item: T) => SchemaIR, ctx: CodeGenContext): T[]; //#endregion export { CALL_COST, EXTRACT_CAP, HOISTABLE, MIN_EXTRACT, estimateFastCost, orderByRuntimeCost, predictedInlineSize }; //# sourceMappingURL=fast-size.d.ts.map