Performance
ChatControl is highly optimized — if you configure it with respect to your hardware and player base.
TL;DR
- Set
Rules.Case_Insensitiveto false in settings.yml - Set
Private_Messages.Toaststo false to eliminate disk operations - Disable PacketEvents integration in settings.yml if you don't need the [X] message removal feature
- Review your regular expressions and JavaScript variables for efficiency
Understanding Performance Impact
For every chat message, ChatControl:
- Compiles each format part and adds gradients
- Executes JavaScript for format conditions
- Replaces variables (including JavaScript ones)
- Checks each word against all rules
- Logs the message and sends it to spies
All of these operations can be configured or disabled.
Key Performance Factors
| Component | Performance Impact |
|---|---|
| Rules (rules/ folder) | Rule quantity, complexity of conditions, and regex patterns |
| Formats (formats/ folder) | Format options, especially JavaScript conditions |
| Messages (messages/ folder) | Message quantity and conditional logic |
| Variables (variables/ folder) | Variable quantity and complexity of conditions |
The plugin's performance is ~80% dependent on your configuration.
Optimizing Performance
Rules
- Larger, more complex regular expressions require more processing cycles
- Use regex101.com to test expression efficiency
- When testing, enable "insensitive" and "unicode" flags for accurate results
JavaScript Variables
Each JavaScript execution requires compilation and interpretation with limited caching. Limit JavaScript variables on performance-critical servers.
Troubleshooting Performance Issues
- Install the Spark profiler
- Run your server under normal conditions for at least 30 minutes (2+ hours for smaller servers)
- Generate a full report and open a GitHub issue with the report attached
Database Performance
If you experience lag related to database operations:
- Use MySQL over SQLite for servers with 50+ players. SQLite uses file-level locking which blocks concurrent reads/writes.
- Keep your database server close — ideally on the same machine or within the same datacenter. High latency to MySQL causes delays on player joins, chat messages, and data saves.
- Increase connection pool size if you see "connection timeout" errors in console. Check database.yml for pool settings.
- Prune old data — large log tables slow down queries. ChatControl automatically removes old data but you can adjust the retention period.
- Lag on player join is often caused by loading player data (nicks, channels, warning points, toggle states) from the database. Ensure your database has proper indexes (ChatControl creates these automatically).