mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
f39e71472f
Major performance improvements:
1. Build book/chapter indexes at Bible init for O(1) lookups instead of
O(n) iteration through 31,102 verses on every API request
2. Pre-compute total word count at init instead of splitting all verse
text on every /stats or /about request
3. Add get_verses_by_book() and get_total_words() methods to Bible class
4. Replace all iter_verses()/iter_chapters() calls in API routes with
indexed get_verses_by_book_chapter() and get_chapters_for_book()
5. Remove unused Scofield commentary load at startup (27KB saved)
6. Increase GZip minimum_size from 500 to 1000 bytes to reduce CPU
waste on tiny responses
Affected endpoints (now O(1) instead of O(n)):
- GET /api/books, /api/books/{book}, /api/books/{book}/text
- GET /api/books/{book}/pdf, /api/books/{book}/chapters/{chapter}
- GET /api/bible, /api/stats, /about/stats
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>