Files
kjvstudy.org/kjvstudy_org
kennethreitz f39e71472f Performance: add Bible indexes, eliminate O(n) iterations, remove dead code
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>
2026-03-20 01:20:33 -04:00
..
2025-11-30 21:26:59 -05:00
2025-12-01 13:48:47 -05:00