Estimate the serialized JSON byte size of a value without actually serializing it. Used on hot paths (enqueuing runs for batched tracing) where the exact serialized size is not required -- only a reasonable approximation for soft memory accounting.
Walks the object graph in O(n) without allocating a JSON string, avoiding the event-loop blocking that JSON.stringify causes on large payloads.
Accuracy notes (all estimates are approximate, never exact):
interface EstimatedSizeLength (in UTF-8 bytes) of the longest single string value encountered anywhere in the payload graph. Callers can use this as a shape-aware dispatch signal -- for example, to decide whether to offload serialize to a worker thread (which only pays off when a payload contains one or more large strings, since V8 shares string storage across isolates via refcount).
Approximate serialized JSON byte size.