You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,8 @@ Perform async work synchronously in Node.js using `worker_threads`, or `child_pr
23
23
-[Usage](#usage)
24
24
-[Install](#install)
25
25
-[API](#api)
26
-
-[Env variables](#env-variables)
26
+
-[`Node` compatibility](#node-compatibility)
27
+
-[Envs](#envs)
27
28
-[TypeScript](#typescript)
28
29
-[Benchmark](#benchmark)
29
30
-[Changelog](#changelog)
@@ -71,7 +72,11 @@ You must make sure:
71
72
1. if `worker_threads` is enabled (by default), the `result` is serialized by [`Structured Clone Algorithm`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm)
72
73
2. if `child_process` is used, the `result` is serialized by `JSON.stringify`
73
74
74
-
### Env variables
75
+
### `Node` compatibility
76
+
77
+
`worker_threads` is available from `Node 8.10` with flag `--experimental-worker` and only enabled by default from `Node 12.11`, so you may want to enable it by using `node --experimental-worker` or setting env `NODE_OPTIONS="--experimental-worker"` for better performance.
78
+
79
+
### Envs
75
80
76
81
1.`SYNCKIT_WORKER_THREADS`: whether or not enable `worker_threads`, it's enabled by default, set as `0` to disable
77
82
2.`SYNCKIT_BUFFER_SIZE`: `bufferSize` to create `SharedArrayBuffer` for `worker_threads` (default as `1024`), or `maxBuffer` for `child_process` (no default)
'`worker_threads` is not available in current environment,\nyou may want to enable it by using `node --experimental-worker` or setting env `NODE_OPTIONS="--experimental-worker"` for better performance',
0 commit comments