INNER CODE UNIT · TypeScript

perWorker

voxelize/voxelize · packages/core/src/core/network/index.ts:568

    const perWorker = Math.ceil(packets.length / availableWorkers);

    const batches: ArrayBuffer[][] = [];
    for (let i = 0; i < packets.length; i += perWorker) {
      batches.push(packets.slice(i, i + perWorker));
    }

    Promise.all(
      batches.map((batch, idx) =>
        this.decode(batch).then((msgs) => ({ idx, msgs })),
      ),
    ).then((results) => {
      if (!this.connected) {
        return;
      }

      results.sort((a, b) => a.idx - b.idx);
      for (const { msgs } of results) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…