Skip to content

Commit d825b5a

Browse files
committed
add nx graph time
1 parent 0af1768 commit d825b5a

File tree

3 files changed

+61
-31
lines changed

3 files changed

+61
-31
lines changed

nx.json

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,34 +31,7 @@
3131
},
3232
"exclude": ["cpu-profiling-e2e/*"]
3333
},
34-
{
35-
"plugin": "@nx/vite/plugin",
36-
"options": {
37-
"buildTargetName": "build",
38-
"testTargetName": "unit-test",
39-
"serveTargetName": "serve",
40-
"devTargetName": "dev",
41-
"previewTargetName": "preview",
42-
"serveStaticTargetName": "serve-static",
43-
"typecheckTargetName": "typecheck",
44-
"buildDepsTargetName": "build-deps",
45-
"watchDepsTargetName": "watch-deps"
46-
}
47-
},
48-
{
49-
"plugin": "@nx/vite/plugin",
50-
"options": {
51-
"testTargetName": "integration-test"
52-
},
53-
"exclude": []
54-
},
55-
{
56-
"plugin": "@nx/vite/plugin",
57-
"options": {
58-
"testTargetName": "e2e-test"
59-
},
60-
"exclude": []
61-
},
34+
6235
{
6336
"plugin": "@nx/eslint/plugin",
6437
"options": {
@@ -105,19 +78,34 @@
10578
"dependsOn": ["^build"],
10679
"executor": "@nx/vitest:vitest",
10780
"outputs": ["{workspaceRoot}/coverage/unit/{projectName}"],
81+
"inputs": [
82+
"default",
83+
"^default",
84+
"testFixtures"
85+
],
10886
"options": {
10987
"config": "packages/{projectName}/vitest.unit.config.ts"
11088
}
11189
},
11290
"integration-test": {
11391
"dependsOn": ["^build"],
11492
"outputs": ["{workspaceRoot}/coverage/integration/{projectName}"],
115-
"executor": "@nx/vitest:vitest"
93+
"executor": "@nx/vitest:vitest",
94+
"inputs": [
95+
"default",
96+
"^default",
97+
"testFixtures"
98+
]
11699
},
117100
"e2e-test": {
118101
"dependsOn": ["^build"],
119102
"executor": "@nx/vitest:vitest",
120-
"outputs": ["{workspaceRoot}/coverage/e2e/{projectName}"]
103+
"outputs": ["{workspaceRoot}/coverage/e2e/{projectName}"],
104+
"inputs": [
105+
"default",
106+
"^default",
107+
"testFixtures"
108+
]
121109
},
122110
"lint": {
123111
"cache": true,

package-lock.json

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Case Study - Nx graph time
2+
3+
## Measured graphs
4+
5+
Use native Node.js CPU profiling to analyze where time is spent when calculating Nx graphs.
6+
7+
### Project Graph
8+
9+
Measure the project graph creation:
10+
11+
```bash
12+
# Prerequisite (once): install local deps so ./node_modules/.bin/nx exists
13+
NX_DAEMON=false NX_CACHE=false \
14+
npx -y @push-based/cpu-prof \
15+
--cpu-prof-dir ./profiles/nx-show-projects \
16+
node ./node_modules/nx/bin/nx.js show projects --json
17+
```
18+
19+
### Task Graph
20+
21+
Measure the task graph creation:
22+
23+
```bash
24+
# Prerequisite (once): install local deps so ./node_modules/.bin/nx exists
25+
NX_DAEMON=false NX_CACHE=false \
26+
npx -y @push-based/cpu-prof \
27+
--cpu-prof-dir ./profiles/nx-show-project \
28+
node ./node_modules/nx/bin/nx.js show project <project-name> --json
29+
```
30+
31+
|

0 commit comments

Comments
 (0)