Skip to content

Commit

Permalink
feat: default transformMap concurrency is bumped from 16 to 32
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Apr 22, 2024
1 parent 01a6e03 commit 16416c2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/stream/transform/transformMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export interface TransformMapOptions<IN = any, OUT = IN> {
/**
* Number of concurrently pending promises returned by `mapper`.
*
* @default 16 (to match default highWatermark option for objectMode streams)
* Default is 32.
* It was recently changed up from 16, after some testing that shown that
* for simple low-cpu mapper functions 32 produces almost 2x throughput.
* For example, in scenarios like streaming a query from Datastore.
*/
concurrency?: number

Expand Down Expand Up @@ -117,7 +120,7 @@ export interface TransformMapStatsSummary extends TransformMapStats {
*
* Only works in objectMode (due to through2Concurrent).
*
* Concurrency defaults to 16.
* Concurrency defaults to 32.
*
* If an Array is returned by `mapper` - it will be flattened and multiple results will be emitted from it. Tested by Array.isArray().
*/
Expand All @@ -126,7 +129,7 @@ export function transformMap<IN = any, OUT = IN>(
opt: TransformMapOptions<IN, OUT> = {},
): TransformTyped<IN, OUT> {
const {
concurrency = 16,
concurrency = 32,
predicate, // we now default to "no predicate" (meaning pass-everything)
errorMode = ErrorMode.THROW_IMMEDIATELY,
flattenArrayOutput,
Expand Down

0 comments on commit 16416c2

Please sign in to comment.