Performance Profiling
If Grats is running slowly in your project, you can capture a CPU performance profile and share it with the Grats maintainers to help identify potential performance improvements.
Capturing a Performance Profile
Node.js has built-in support for CPU profiling via the --cpu-prof flag. To capture a profile of a Grats run:
node --cpu-prof --cpu-prof-name=grats-profile.cpuprofile ./node_modules/grats/dist/src/cli.js
This will:
- Run Grats on your project
- Write a CPU profile to
grats-profile.cpuprofilein your current directory
Viewing the Profile
- Open Chrome and navigate to
chrome://inspect - Click "Open dedicated DevTools for Node"
- Go to the Performance tab
- Click Load profile and select your
.cpuprofilefile
Sharing the Profile
When reporting a performance issue:
- Run the profiling command above
- Open a GitHub issue
- Attach the
.cpuprofilefile to the issue - Include the version of Grats you have installed