Performance Tuning
Optimize InkGen’s performance for large projects.
Build Performance
Parallel Processing
Enable parallel processing in your configuration:
{
"parallel": true,
"maxWorkers": 4
}
Incremental Generation
Use incremental generation to only process changed files:
npx inkgen generate --incremental
Generated Code Performance
Code Splitting
Split generated code into multiple modules:
{
"codeSplitting": {
"enabled": true,
"moduleSize": 50000
}
}
Tree Shaking
Enable tree shaking in your bundler configuration to remove unused code:
// webpack.config.js
export default {
mode: 'production',
optimization: {
usedExports: true,
}
};
Caching
Enable caching to speed up subsequent builds:
{
"cache": {
"enabled": true,
"directory": "./.inkgen-cache"
}
}
Benchmarking
Profile your generation process:
npx inkgen generate --profile
This will output timing information for each phase of code generation.
Tips and Tricks
- Use selectors - Only generate code for profiles you need
- Lazy load - Generate code on-demand rather than upfront
- Compress output - Enable compression for generated files
- Monitor memory - Use Node.js heap snapshots to identify leaks
For more information, refer to the Architecture section.