@malloydata/malloy-profiler 0.0.317 → 0.0.319

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,23 @@
1
1
  # Malloy Stable Request Profiler
2
2
 
3
- This package enables profiling of the Malloy compiler. Currently it only works with stateless compilation of queries. In the future we can extend it support other kinds of compilation.
3
+ This package enables profiling of the Malloy compiler. Currently it only works with stateless compilation of queries. In the future we can extend it to support other kinds of compilation.
4
4
 
5
- Usage:
5
+ ## Usage
6
6
 
7
- - Write a Malloy query request to a file.
8
- - Run `npm run profile path/to/file.json`
7
+ ### Basic timing (100 iterations with average):
8
+ ```bash
9
+ npm run time path/to/file.json
10
+ ```
11
+
12
+ ### Detailed flame graph profiling:
13
+ ```bash
14
+ npm run profile path/to/file.json
15
+ ```
16
+
17
+ This creates a `.cpuprofile` file and provides instructions for viewing the flame graph in Chrome DevTools.
18
+
19
+ To view the flame graph:
20
+ 1. Open Chrome and navigate to `chrome://inspect`
21
+ 2. Click "Open dedicated DevTools for Node"
22
+ 3. Go to the Performance tab
23
+ 4. Load the generated `.cpuprofile` file
package/package.json CHANGED
@@ -17,13 +17,12 @@
17
17
  "test": "jest --config=../jest.config.js",
18
18
  "build": "tsc --build",
19
19
  "clean": "tsc --build --clean",
20
- "profile": "npx clinic flame -- node dist/profile.js",
20
+ "profile": "./scripts/flame_profile.sh",
21
21
  "time": "ts-node src/timer.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@malloydata/malloy": "0.0.317",
25
- "@malloydata/malloy-interfaces": "0.0.317",
26
- "clinic": "^13.0.0"
24
+ "@malloydata/malloy": "0.0.319",
25
+ "@malloydata/malloy-interfaces": "0.0.319"
27
26
  },
28
- "version": "0.0.317"
27
+ "version": "0.0.319"
29
28
  }
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+
3
+ # Run Node.js with CPU profiling
4
+ node --cpu-prof dist/profile.js
5
+
6
+ # Find the generated .cpuprofile file
7
+ PROFILE_FILE=$(ls -t *.cpuprofile 2>/dev/null | head -1)
8
+
9
+ if [ -n "$PROFILE_FILE" ]; then
10
+ echo ""
11
+ echo "✅ Profile created: $PROFILE_FILE"
12
+ echo ""
13
+ echo "📊 To view flame graph:"
14
+ echo "1. Open Chrome and navigate to: chrome://inspect"
15
+ echo "2. Click \"Open dedicated DevTools for Node\""
16
+ echo "3. Go to the Performance tab"
17
+ echo "4. Click \"Load profile\" and select: $PROFILE_FILE"
18
+ echo ""
19
+ else
20
+ echo "❌ No .cpuprofile file was generated"
21
+ exit 1
22
+ fi