Why is pool: 'forks' not default? #4914
-
From my very simple testing pool: 'forks' is slightly faster than the default pooling method. Initial run is like 500ms vs 300ms with pool: 'forks' for example. Why is it not the default? I also tested |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Good question. We optimized |
Beta Was this translation helpful? Give feedback.
-
Based on Tinypool's benchmarks Vitest's $ node isolate-benchmark.mjs
Options: { THREADS: 8, ROUNDS: 2000, IS_BUN: false }
Tinypool { runtime: 'worker_threads' } | START
Tinypool { runtime: 'worker_threads' } | END 10371 ms
Cooling down for 2s
................... ✓
Tinypool { runtime: 'child_process' } | START
Tinypool { runtime: 'child_process' } | END 12100 ms
Cooling down for 2s
................... ✓
Native node:worker_threads | START
Native node:worker_threads | END 9199 ms
Cooling down for 2s
................... ✓ |
Beta Was this translation helpful? Give feedback.
-
+1 I have just switched from Mocha to Vitest. I had V8 FATAL errors using code that used node-postgres native and node-libcurl because of the current default. It took me a while to investigate how vitest runs tests and to find the argument '--pool=forks' what was I needed so if it's also faster, as well as 'safer' it ought to be the default. |
Beta Was this translation helpful? Give feedback.
-
Maybe Vitest should indeed default to In the |
Beta Was this translation helpful? Give feedback.
Good question. We optimized
forks
pool in Vitest 1.0 and didn't look into performance differences yet, maybe it will be the default in the future.