Repository navigation
perf(backend): query dpkg once when listing the catalog - #7
Open
albertonoys wants to merge 1 commit into
Open
albertonoys wants to merge 1 commit into
albertonoys wants to merge 1 commit into
Conversation
- --summary ran dpkg-query twice per app (146 runs for 73 apps); each run parses the whole dpkg status file, ~0.2 s on the device, so opening the store spent ~29 s here - summary_output now takes one dpkg-query -W snapshot of every package and answers package_state() from it; other callers still query live, so install and repair checks see fresh state - a failed snapshot falls back to per-package queries; a package missing from the snapshot is reported as absent, as dpkg-query's exit 1 was - on a CardputerZero with 1900 packages, --summary drops from 28.8 s to 2.2 s with identical output - tests: dpkg-query fakes answer the batched form, and --summary must make exactly one call
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening the store takes ~35 s on a CardputerZero, almost all of it in the catalog summary:
--summaryrunsdpkg-querytwice per app (146 runs for 73 apps).Change
summary_output()takes onedpkg-query -Wsnapshot of every package, andpackage_state()answers from it while the summary is built.Result
On a real device,
--summarygoes from 28.8 s to 2.2 s, with byte-for-byte identical output.Tests
dpkg-queryfakes answer the batched form.--summaryto make exactly onedpkg-querycall. The current binary fails it.test_native_backend(1151 checks) andtest_native_backend.shpass.test_package_repair_helper.shwas skipped: it needs root.Not changed
ui_initstill clears the registry, icon and screenshot cache on every launch (clear_cached_catalog()), so the store re-downloads all artwork and starts from an empty list each time, which costs about 5 s here. That looks deliberate, so I left it out of this PR.