@@ -18,7 +18,7 @@ const availableGenerators = Object.keys(publicGenerators);
1818// When spawning more than a said number of threads, the overhead of context switching
1919// and CPU contention starts to degrade performance rather than improve it.
2020// Therefore, we set the optimal threads to half the number of CPU cores, with a minimum of 6.
21- const optimalThreads = Math . min ( Math . floor ( cpus ( ) . length / 2 ) , 6 ) ;
21+ const optimalThreads = Math . max ( cpus ( ) . length , 2 ) ;
2222
2323/**
2424 * @typedef {Object } Options
@@ -66,11 +66,11 @@ export default {
6666 } ,
6767 threads : {
6868 flags : [ '-p' , '--threads <number>' ] ,
69- desc : 'Number of worker threads to use' ,
69+ desc : 'Number of worker threads to use (minimum: 2) ' ,
7070 prompt : {
7171 type : 'text' ,
7272 message : 'How many threads to allow' ,
73- initialValue : String ( Math . max ( optimalThreads , 1 ) ) ,
73+ initialValue : String ( Math . max ( optimalThreads , 2 ) ) ,
7474 } ,
7575 } ,
7676 chunkSize : {
@@ -79,7 +79,7 @@ export default {
7979 prompt : {
8080 type : 'text' ,
8181 message : 'Items per worker thread' ,
82- initialValue : '20 ' ,
82+ initialValue : '10 ' ,
8383 } ,
8484 } ,
8585 version : {
@@ -163,7 +163,7 @@ export default {
163163 version : coerce ( opts . version ) ,
164164 releases,
165165 gitRef : opts . gitRef ,
166- threads : parseInt ( opts . threads , 10 ) ,
166+ threads : Math . max ( parseInt ( opts . threads , 10 ) , 2 ) ,
167167 chunkSize : parseInt ( opts . chunkSize , 10 ) ,
168168 index,
169169 typeMap,
0 commit comments