Perf: comlink, workercom, @fcanvas/communicate

, so I looked into three npm packages for working with WebWorker:

I need to communicate hundreds of data (text or ArrayBuffer) per second between the main thread and the webworker, so performance is essential. After reading the documentation of @fcanvas/communicate, I decided to use the MessageChannel as demonstrated in the code snippets below.

import { listen } from "@fcanvas/communicate"

listen(self, "send port", (port: MessagePort) => {
  listen(port, "sort_db", () => {
    // ...
  // ...
import Worker from "./worker.ts?worker"
import { put } from "@fcanvas/communicate"

function createWorker() {
  const { port1, port2 } = new MessageChannel()

  const worker = new Worker()

  await put(worker, "send port", port2)

  // put

I am looking for advice on which package to use for optimal performance.

Based on the information provided, the comlink package would be the recommended choice for optimal performance.