dvReportCopiedInput function

void dvReportCopiedInput(
  1. DVWorkerCapability capability,
  2. Object? input
)

DV-WORKER-004, once: bytes were copied to a worker because this page cannot share memory.

Only for bytes. Copying a small map is not the performance surprise the diagnostic is for; copying a buffer somebody designed to share is.

Implementation

void dvReportCopiedInput(DVWorkerCapability capability, Object? input) {
  if (_copiedReported ||
      capability.mechanism != DVWorkerMechanism.webWorker ||
      capability.sharedMemory ||
      !_holdsBytes(input)) {
    return;
  }
  _copiedReported = true;
  DVObservability.log(
    'Shared memory is unavailable; input was copied to the worker.',
    level: DVLogLevel.info,
    code: 'DV-WORKER-004',
  );
}