Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Commit b06537f

Browse files
feat: default concurrency changed back from 32 to 16 for transformMap
1 parent b4ff829 commit b06537f

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"devDependencies": {
4242
"@naturalcycles/bench-lib": "^3.0.0",
4343
"@naturalcycles/dev-lib": "^15.0.3",
44-
"@types/node": "^20.1.0",
44+
"@types/node": "^22.1.0",
4545
"@types/yargs": "^16.0.0",
4646
"jest": "^29.0.0"
4747
},

src/stream/transform/transformMap.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ export interface TransformMapOptions<IN = any, OUT = IN> {
4040
/**
4141
* Number of concurrently pending promises returned by `mapper`.
4242
*
43-
* Default is 32.
43+
* Default is 16.
4444
* It was recently changed up from 16, after some testing that shown that
4545
* for simple low-cpu mapper functions 32 produces almost 2x throughput.
4646
* For example, in scenarios like streaming a query from Datastore.
47+
* UPD: changed back from 32 to 16, "to be on a safe side", as 32 sometimes
48+
* causes "Datastore timeout errors".
4749
*/
4850
concurrency?: number
4951

@@ -120,7 +122,7 @@ export interface TransformMapStatsSummary extends TransformMapStats {
120122
*
121123
* Only works in objectMode (due to through2Concurrent).
122124
*
123-
* Concurrency defaults to 32.
125+
* Concurrency defaults to 16.
124126
*
125127
* If an Array is returned by `mapper` - it will be flattened and multiple results will be emitted from it. Tested by Array.isArray().
126128
*/
@@ -129,7 +131,7 @@ export function transformMap<IN = any, OUT = IN>(
129131
opt: TransformMapOptions<IN, OUT> = {},
130132
): TransformTyped<IN, OUT> {
131133
const {
132-
concurrency = 32,
134+
concurrency = 16,
133135
predicate, // we now default to "no predicate" (meaning pass-everything)
134136
errorMode = ErrorMode.THROW_IMMEDIATELY,
135137
flattenArrayOutput,

yarn.lock

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,20 +1178,13 @@
11781178
dependencies:
11791179
"@types/node" "*"
11801180

1181-
"@types/node@*", "@types/node@^22.0.0":
1181+
"@types/node@*", "@types/node@^22.0.0", "@types/node@^22.1.0":
11821182
version "22.1.0"
11831183
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.1.0.tgz#6d6adc648b5e03f0e83c78dc788c2b037d0ad94b"
11841184
integrity sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==
11851185
dependencies:
11861186
undici-types "~6.13.0"
11871187

1188-
"@types/node@^20.1.0":
1189-
version "20.14.14"
1190-
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.14.tgz#6b655d4a88623b0edb98300bb9dd2107225f885e"
1191-
integrity sha512-d64f00982fS9YoOgJkAMolK7MN8Iq3TDdVjchbYHdEmjth/DHowx82GnoA+tVUAN+7vxfYUgAzi+JXbKNd2SDQ==
1192-
dependencies:
1193-
undici-types "~5.26.4"
1194-
11951188
"@types/normalize-package-data@^2.4.0":
11961189
version "2.4.4"
11971190
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901"
@@ -5341,11 +5334,6 @@ unbox-primitive@^1.0.2:
53415334
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.7.tgz#970e33963af9a7dda228f17ebe8399e5fbe63a10"
53425335
integrity sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==
53435336

5344-
undici-types@~5.26.4:
5345-
version "5.26.5"
5346-
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
5347-
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
5348-
53495337
undici-types@~6.13.0:
53505338
version "6.13.0"
53515339
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.13.0.tgz#e3e79220ab8c81ed1496b5812471afd7cf075ea5"

0 commit comments

Comments
 (0)