Performance Overview
Workspace Scanning
Efficient file indexing and incremental updates
Memory Usage
Optimized memory allocation with mimalloc
Incremental Analysis
Only re-analyze changed files
Workspace Configuration
Ignoring Unnecessary Files
Exclude directories and files that don’t need analysis:.emmyrc.json
Common Directories to Ignore
Common Directories to Ignore
- Build outputs:
build/,dist/,output/,bin/ - Dependencies:
node_modules/,vendor/,third_party/ - Version control:
.git/,.svn/,.hg/ - IDE files:
.vscode/,.idea/ - Generated code: Auto-generated Lua files
- Test fixtures: Large test data files
- Documentation:
docs/,documentation/
File Size Limits
Control which files are preloaded:.emmyrc.json
Maximum file size in bytes to preload during startup. Files larger than this are analyzed on-demand. Set to
0 to preload all files.Workspace Roots
Define multiple workspace roots for better organization:.emmyrc.json
- Focus on relevant directories
- Improve module resolution
- Reduce memory usage
Incremental Analysis
Reindexing Configuration
Control automatic reindexing:.emmyrc.json
Reindexing Options
Reindexing Options
Diagnostic Intervals
Control diagnostic update frequency:.emmyrc.json
diagnosticInterval to reduce CPU usage:
- 500ms - Default, responsive for most projects
- 1000ms - Better for large projects
- 2000ms - Best for very large projects or slower machines
Memory Optimization
Built-in Optimizations
EmmyLua Analyzer includes several memory optimizations:Mimalloc Allocator
Fast memory allocator providing ~50% startup performance improvement
Incremental Parsing
Only re-parse changed portions of files
Smart Caching
Cache frequently accessed type information
Lazy Loading
Load library definitions on-demand
Library Management
Optimize library loading:.emmyrc.json
Resource Paths
Limit resource path scanning:.emmyrc.json
Feature-Specific Optimization
Completion Performance
.emmyrc.json
Completion Settings Impact
Completion Settings Impact
autoRequire: false- Slightly faster completion, but less convenientcallSnippet: false- Reduces completion overheadbaseFunctionIncludesName: false- Smaller completion lists
Hints and Inlays
.emmyrc.json
indexHint- Most expensive, disable for large fileslocalHint- Can be noisy in large functions
References and Search
.emmyrc.json
Semantic Tokens
.emmyrc.json
Diagnostic Optimization
Selective Diagnostics
Disable expensive diagnostics:.emmyrc.json
Diagnostic Performance Impact
Diagnostic Performance Impact
High impact (consider disabling in large files):
unused- Requires full scope analysisundefined-field- Checks all table accessescode-style-check- Additional parsing pass
param-type-not-match- Type checking overheadreturn-type-mismatch- Control flow analysis
syntax-error- Fast to checkdeprecated- Simple lookup
File-Specific Diagnostics
Disable diagnostics in specific files:Large Project Strategies
Strategy 1: Workspace Splitting
Split large monorepos into multiple workspaces:- Library paths
- Ignore patterns
- Diagnostic settings
Strategy 2: Progressive Analysis
Analyze code incrementally:Strategy 3: Lazy Loading
Configure lazy loading for libraries:.emmyrc.json
Benchmarking
Measuring Startup Time
Measuring Analysis Time
Memory Profiling
Monitor memory usage:Performance Monitoring
LSP Metrics
Enable LSP logging to track performance:Performance Regression Detection
Track performance over time:benchmark.sh
Troubleshooting Performance Issues
High CPU Usage
Symptoms: Editor feels sluggish, fan spinning Solutions:-
Increase
diagnosticInterval: -
Disable expensive diagnostics:
-
Disable automatic reindexing:
High Memory Usage
Symptoms: System running out of memory, swap usage high Solutions:-
Ignore large directories:
-
Set file size limit:
-
Reduce library paths:
Slow Completion
Symptoms: Completion takes >500ms Solutions:-
Disable auto-require:
-
Disable call snippets:
- Check for circular dependencies in requires
Slow References
Symptoms: “Find References” takes >2s Solutions:-
Disable fuzzy search:
-
Disable short string search:
Hardware Recommendations
Minimum Requirements
- CPU: 2 cores, 2.0 GHz
- RAM: 4 GB
- Storage: SSD recommended
- Projects: Up to 1,000 files
Recommended Configuration
- CPU: 4+ cores, 3.0+ GHz
- RAM: 8+ GB
- Storage: NVMe SSD
- Projects: Up to 10,000 files
Large Project Configuration
- CPU: 8+ cores, 3.5+ GHz
- RAM: 16+ GB
- Storage: Fast NVMe SSD
- Projects: 10,000+ files
Comparison with Other Tools
| Metric | EmmyLua Analyzer (Rust) | lua-language-server |
|---|---|---|
| Startup time (10k files) | 1-2s | 5-10s |
| Memory usage | 200-400 MB | 500-800 MB |
| Incremental analysis | Yes | Yes |
| Type inference speed | Fast | Moderate |
| Completion latency | <100ms | <200ms |
Benchmarks vary by project structure and hardware. Your results may differ.
Best Practices Summary
Ignore Aggressively
Exclude all non-source directories
Tune Diagnostics
Only enable diagnostics you actively use
Monitor Performance
Track metrics to catch regressions early
Split Large Projects
Use multiple workspaces for better isolation
Next Steps
Type Checking
Optimize type checking performance
CLI Tools
Use CLI for batch analysis
