()
| 437 | } |
| 438 | |
| 439 | function drainBatch() { |
| 440 | if (pendingBytes <= BATCH_HWM) { |
| 441 | // Swap instead of splice - avoids copying the array. |
| 442 | const batch = pending; |
| 443 | pending = []; |
| 444 | pendingBytes = 0; |
| 445 | return batch; |
| 446 | } |
| 447 | const batch = []; |
| 448 | let batchBytes = 0; |
| 449 | while (pending.length > 0 && batchBytes < BATCH_HWM) { |
| 450 | const buf = ArrayPrototypeShift(pending); |
| 451 | ArrayPrototypePush(batch, buf); |
| 452 | const len = TypedArrayPrototypeGetByteLength(buf); |
| 453 | batchBytes += len; |
| 454 | pendingBytes -= len; |
| 455 | } |
| 456 | return batch; |
| 457 | } |
| 458 | |
| 459 | let finalized = false; |
| 460 |
no outgoing calls
no test coverage detected
searching dependent graphs…