Roadmap 0.10, Performance roadmap — wave 3

PERF.41 Website: Library card lists run nine queries per card: /library/author 914 queries (897 ms), /library/browse 444 (587 ms) (extends PERF.12)

  • Fix
  • Planned

Measured with bin/admin-perf.php: LibraryItems::display() (LibraryItems.php:254-266) calls LibraryVersions::byId and LibraryAuthors::publicAuthor (Auth::byId plus LibraryAuthors::uuidFor, two statements) for every row browse() already selected; item-card.inc:16 then calls LibraryPreview::forVersion, which runs LibraryVersions::fileAccess (LibraryItems::byId again, LibraryVersions.php:524), LibraryItems::byId (LibraryPreview.php:55) and LibraryFiles::byId. None of the 115 lookup methods in the service layer except one has a per-request memo. Fix (a) S: a static per-request memo keyed by id in Auth::byId, LibraryVersions::byId, LibraryItems::byId, LibraryFiles::byId and LibraryAuthors::uuidFor, cleared by the write methods: removes about 600 of the 914 statements on the author page. (b) M: browse() selects the card columns in one statement (item, current version id, license, preview file, published_at, author name, maker flag, uuid) and display() takes the joined row; fileAccess() takes the item row it already has. Target: browse under 25 statements, author under 20.

Add a comment

Community comments

No comments yet

Add detail as we go: how you would use it, files or steps that show the problem, what other programs do. The team reads every comment.

Sign in or create a free account to add a comment.