Empirical testing shows that Sass compilation performance is optimal when the number of physical cores is used for concurrent compilation. In this patch, I use systeminformation to get access to the number of physical cores because node only exposes the number of cores which includes virtual (hypervisor) cores.
Environment Variables:
JOBS - a general setting for concurrency in an ember-cli build.
SASS_JOBS - will override the number specified by JOBS. If set to auto it will override
the value of JOBS and behave as if neither of them were set.
UV_THREADPOOL_SIZE - controls the number of threads in the uv threadpool. When UV_THREADPOOL_SIZE is unset, we will set it to the number of concurrent sass jobs we decide to use as long as this is not smaller than the default of 4. When UV_THREADPOOL_SIZE is set, it will cap the number of concurrent sass jobs we will perform.
DEBUG - When debugging broccoli-eyeglass:concurrency, you will see detailed logging explaining how the concurrency level is is determined.
The number of Sass jobs requested is overridden or ignored when it is clearly going to just cause jobs to spend longer in the uv queue and inflate the compilation times or result in obviously worse performance.
Empirical testing shows that Sass compilation performance is optimal when the number of physical cores is used for concurrent compilation. In this patch, I use
systeminformation
to get access to the number of physical cores because node only exposes the number of cores which includes virtual (hypervisor) cores.Environment Variables:
JOBS
- a general setting for concurrency in an ember-cli build.SASS_JOBS
- will override the number specified byJOBS
. If set toauto
it will override the value ofJOBS
and behave as if neither of them were set.UV_THREADPOOL_SIZE
- controls the number of threads in the uv threadpool. WhenUV_THREADPOOL_SIZE
is unset, we will set it to the number of concurrent sass jobs we decide to use as long as this is not smaller than the default of 4. WhenUV_THREADPOOL_SIZE
is set, it will cap the number of concurrent sass jobs we will perform.DEBUG
- When debuggingbroccoli-eyeglass:concurrency
, you will see detailed logging explaining how the concurrency level is is determined.The number of Sass jobs requested is overridden or ignored when it is clearly going to just cause jobs to spend longer in the uv queue and inflate the compilation times or result in obviously worse performance.