Guides
Performance profiling
On this page
If Gratos runs slowly in your project, capture a CPU profile and share it with the Gratos maintainers, to help find performance improvements.
Capturing a performance profile
Node.js profiles the CPU with its --cpu-prof flag. To profile a Gratos run, from your project's directory:
node --cpu-prof --cpu-prof-name=gratos-profile.cpuprofile ./node_modules/gratos/dist/cli.js
This:
- runs Gratos on your project;
- writes a CPU profile to
gratos-profile.cpuprofilein the 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
To report a performance issue:
- Run the profiling command above.
- Open a GitHub issue.
- Attach the
.cpuprofilefile to the issue. - Include the version of Gratos you have installed (
gratos --version).