Files
crosspoint-reader-mod/chat-summaries/2026-02-21_16-30-summary.md
cottongin dfbc931c14 mod: Phase 1 - bring forward mod-exclusive files with ActivityManager migration
Brings ~55 mod-exclusive files to the upstream-based mod/master-resync branch:

Activities (migrated to new ActivityManager pattern):
- Clock/Time: SetTimeActivity, SetTimezoneOffsetActivity, NtpSyncActivity
- Dictionary: DictionaryDefinitionActivity, DictionarySuggestionsActivity,
  DictionaryWordSelectActivity, LookedUpWordsActivity
- Bookmark: EpubReaderBookmarkSelectionActivity
- Book management: BookManageMenuActivity, EndOfBookMenuActivity
- OPDS: OpdsServerListActivity, OpdsSettingsActivity
- Utility: DirectoryPickerActivity, NumericStepperActivity

Utilities (unchanged):
- BookManager, BookSettings, BookmarkStore, BootNtpSync
- Dictionary, LookupHistory, TimeSync, OpdsServerStore

Libraries: PlaceholderCover, TableData, ChapterXPathIndexer
Scripts: inject_mod_version, generate_book_icon, preview_placeholder_cover
Docs: KOReader sync XPath mapping

Migration changes:
- ActivityWithSubactivity -> Activity base class
- Callback constructors -> finish()/setResult() pattern
- enterNewActivity() -> startActivityForResult()
- Activity::RenderLock&& -> RenderLock&&

These files won't compile yet - they reference mod settings and I18n
strings that will be added in subsequent phases.

Made-with: Cursor
2026-03-07 15:10:00 -05:00

1.4 KiB
Raw Permalink Blame History

Port Upstream PR #1027: ParsedText Word-Width Cache and Hyphenation Early Exit

Task

Ported upstream PR #1027 (jpirnay) into the mod. The PR reduces ParsedText::layoutAndExtractLines CPU time by 59% via two independent optimizations.

Changes Made

lib/Epub/Epub/ParsedText.cpp (single file):

  1. Added #include <cstring> for memcpy/memcmp
  2. Added 128-entry direct-mapped word-width cache in the anonymous namespace (WordWidthCacheEntry, FNV-1a hash, cachedMeasureWordWidth). 4 KB in BSS, zero heap allocation.
  3. Switched calculateWordWidths to use cachedMeasureWordWidth instead of measureWordWidth
  4. Added lineBreakIndices.reserve(totalWordCount / 8 + 1) in computeLineBreaks
  5. In hyphenateWordAtIndex: added reusable prefix string buffer (avoids per-iteration substr allocations) and early exit break when prefix exceeds available width (ascending byte-offset order means all subsequent candidates will also be too wide)

mod/prs/MERGED.md: Added PR #1027 entry (TOC link + full section with context, changes, differences, discussion).

Key Adaptation

The upstream PR targets std::list-based code, but our mod already uses std::vector (from PR #1038). List-specific optimizations (splice in extractLine, std::next vs std::advance, continuesVec pointer sync) were not applicable. Only the algorithmic improvements were ported.

Follow-up Items

  • None. Port is complete.