Commit graph

2 commits

Author SHA1 Message Date
1913a00f27 Optimize message history loading
Previous implementation:
- Allocated MAX_MESSAGES * 10 (1000 messages) temporarily
- Wasted ~100KB per server startup
- Could fail if log file grows very large

New implementation:
- Track file positions of last 1000 lines
- Seek to appropriate position before reading
- Only allocate MAX_MESSAGES (100 messages)
- Memory usage reduced by 90%

Benefits:
- Faster startup with large log files
- Lower memory footprint
- No risk of allocation failure
- Same functionality maintained

Uses fseek/ftell for efficient log file handling.
2025-12-01 16:30:00 +08:00
63274b92ba Initial commit 2025-07-01 09:00:00 +08:00