Default | Advanced |
---|---|
![]() |
![]() |
NX_DAEMON=false NX_PERF_LOGGING=true NX_CACHE=false nx show projects |
node ./nx-advanced-profile.js --args=show,projects |
Nx is boosting performance, yet when there is a question, it is not always easy to understand where the time is spent.
By default, Nx provides a way to profile the performance of the CLI commands using NX_PERF_LOGGING=true
and NX_DAEMON=false
.
This will create a minimal text log in the terminal.
This script provides a way to profile the performance of the Nx CLI commands in high detail and in a great UI, the Chrome DevTools. It will create a flame graph that shows the time spent in each function and the call stack, including the ones from child processes
- Copy the
tools
folder into your workspace root. - Run
node ./tools/nx-advanced-profile.bin.js
.
The script will create a file named.nx-profiling/nx-show-projects.<Date.now()>.profile.json
. - Open Chrome browser
- Open DevTools
- Go to the
Performance
tab - Drag and drop the
<process>.profile.json
file into the DevTools window.
- Run
node ./tools/nx-advanced-profile.postinstall.js
. This modifies the Nx sourcecode to be patched. (Don't forget to revert your changes) - Run
node ./tools/nx-advanced-profile.bin.js --noPatch
. (As it is now patched inside the file directly) - Open DevTools
Option | Shorthand | Description |
---|---|---|
--args |
comma separated process --args=-t,build |
|
--verbose |
-v |
Show verbose output |
--noPatch |
-p |
Don't patch the Nx sourcecode |
--outDir |
-d |
Output directory |
--outFile |
-f |
Output file |
Example
node ./tools/nx-advanced-profile.bin.js --args=show,projects
node ./tools/nx-advanced-profile.bin.js --args=show,projects --verbose
node ./tools/nx-advanced-profile.bin.js -v -p -o./tools/demo -f=nx-show-projects.json