{
  "schemaVersion": 1,
  "slug": "piscina-vs-default-queue-execution-time",
  "tool": {
    "name": "Piscina",
    "repo": "piscinajs/piscina",
    "version": "5.3.2"
  },
  "environment": {
    "arch": "aarch64",
    "cpu": "Neoverse-N1 x2, CPUQuota 150%",
    "memMB": 2048,
    "os": "Ubuntu 24.04.4 LTS",
    "runtime": "Node.js 24.21.0"
  },
  "method": {
    "hypothesis": "README 주장: FixedQueue가 대규모 대기 작업에서 기본 대기열보다 실행 시간을 최대 여섯 배 줄인다고 제시한다. 이 환경에서 확인: 단일 Worker Thread에 동일한 작업을 대량 제출할 때 FixedQueue의 처리 시간이 기본 대기열보다 짧다.",
    "conditions": [
      "원문의 실행 환경과 달리 Node 스물넷, 단일 Worker Thread, 단순 정수 증가 작업으로 측정한다.",
      "각 대기열은 같은 개수의 결정적 작업을 제출하고 모든 결과를 기다린다.",
      "각 대기열은 측정 전 한 번 워밍업하며, 풀 생성과 워커 초기화는 측정 구간에서 제외한다.",
      "speedup 이 1보다 크면 같은 방향, 그 외에는 다른 방향으로 판정한다."
    ],
    "repeats": 5
  },
  "script": "import { writeFile, rm } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { performance } from 'node:perf_hooks';\nimport { Piscina, FixedQueue } from 'piscina';\n\nconst workerPath = resolve(process.cwd(), 'piscina-benchmark-worker.mjs');\nconst taskCount = 100_000;\nawait writeFile(workerPath, 'export default (value) => value + 1;\\n');\n\nasync function drain(taskQueue) {\n  const pool = new Piscina({ filename: workerPath, minThreads: 1, maxThreads: 1, ...(taskQueue ? { taskQueue } : {}) });\n  await pool.run(0);\n  const started = performance.now();\n  const tasks = Array.from({ length: taskCount }, (_, index) => pool.run(index));\n  const results = await Promise.all(tasks);\n  const elapsed = performance.now() - started;\n  if (results.length !== taskCount || results[taskCount - 1] !== taskCount) throw new Error('unexpected result');\n  await pool.destroy();\n  return elapsed;\n}\n\ntry {\n  await drain(new FixedQueue());\n  await drain();\n  const fixedQueueMs = await drain(new FixedQueue());\n  const defaultQueueMs = await drain();\n  console.log(JSON.stringify({ fixedQueueMs, defaultQueueMs }));\n} finally {\n  await rm(workerPath, { force: true });\n}",
  "scriptSha256": "a370667e4ed018b3245a53447d6ef82e66801b89081382387b7f2f403488de02",
  "runs": [
    {
      "run": 1,
      "fixedQueueMs": 5886.923306999999,
      "defaultQueueMs": 5816.813745000003,
      "wallMs": 23680.124
    },
    {
      "run": 2,
      "fixedQueueMs": 5978.08928,
      "defaultQueueMs": 5960.895902,
      "wallMs": 24085.027
    },
    {
      "run": 3,
      "fixedQueueMs": 5743.005073999999,
      "defaultQueueMs": 5619.452682000003,
      "wallMs": 23530.924
    },
    {
      "run": 4,
      "fixedQueueMs": 5871.809708999999,
      "defaultQueueMs": 5615.998694000002,
      "wallMs": 23677.938
    },
    {
      "run": 5,
      "fixedQueueMs": 5703.423997000002,
      "defaultQueueMs": 5695.225011000002,
      "wallMs": 23127.78
    }
  ],
  "summary": {
    "fixedQueueMs": {
      "median": 5871.809709,
      "min": 5703.423997,
      "max": 5978.08928,
      "unit": "ms"
    },
    "defaultQueueMs": {
      "median": 5695.225011,
      "min": 5615.998694,
      "max": 5960.895902,
      "unit": "ms"
    },
    "speedup": 0.969927
  },
  "chart": {
    "title": {
      "ko": "대기열 처리 시간",
      "en": "Queue processing time"
    },
    "series": [
      {
        "id": "fixed",
        "role": "target",
        "label": {
          "ko": "FixedQueue",
          "en": "FixedQueue"
        },
        "short": {
          "ko": "Fixed",
          "en": "Fixed"
        }
      },
      {
        "id": "default",
        "role": "baseline",
        "label": {
          "ko": "기본 대기열",
          "en": "Default queue"
        },
        "short": {
          "ko": "기본",
          "en": "Default"
        }
      }
    ],
    "panels": [
      {
        "title": {
          "ko": "작업 처리 시간",
          "en": "Task processing time"
        },
        "unit": "ms",
        "kind": "time",
        "better": "lower",
        "keys": {
          "fixed": "fixedQueueMs",
          "default": "defaultQueueMs"
        }
      }
    ]
  },
  "createdAt": "2026-10-24T01:03:04Z",
  "claim": {
    "quote": "In terms of Piscina performance itself, using FixedQueue with a queue size of 100,000 queued tasks can result in up to 6 times faster execution times.",
    "url": "https://github.com/piscinajs/piscina#readme",
    "numbers": [
      6
    ]
  }
}
