squirreling 0.12.16 → 0.12.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/execute/execute.js +6 -2
package/package.json
CHANGED
package/src/execute/execute.js
CHANGED
|
@@ -381,7 +381,11 @@ function computeScanRows(tableNumRows, limit, offset) {
|
|
|
381
381
|
*/
|
|
382
382
|
async function* filterRows(rows, condition, context, limit) {
|
|
383
383
|
const MAX_CHUNK = 256
|
|
384
|
-
|
|
384
|
+
// Without a LIMIT hint, evaluate row-by-row to preserve streaming.
|
|
385
|
+
// With a LIMIT hint, batch in growing chunks to parallelize async cell
|
|
386
|
+
// evaluation across rows that may be discarded anyway.
|
|
387
|
+
let chunkSize = limit ?? 1
|
|
388
|
+
const grow = limit !== undefined
|
|
385
389
|
let rowIndex = 0
|
|
386
390
|
|
|
387
391
|
/** @type {{ row: AsyncRow, rowIndex: number }[]} */
|
|
@@ -400,7 +404,7 @@ async function* filterRows(rows, condition, context, limit) {
|
|
|
400
404
|
if (results[i]) yield buffer[i].row
|
|
401
405
|
}
|
|
402
406
|
buffer = []
|
|
403
|
-
chunkSize = Math.min(chunkSize * 2, MAX_CHUNK)
|
|
407
|
+
if (grow) chunkSize = Math.min(chunkSize * 2, MAX_CHUNK)
|
|
404
408
|
}
|
|
405
409
|
}
|
|
406
410
|
|