refactor: compute slot choices once per manifest

generate_manifest called slot_choices, and pack_overrides called it again with the same five arguments. pack_overrides takes the choices when the caller holds them. Measured on generate_pack.py --all --manifest --offline: 48 calls and 7.0 s in slot_choices before, 24 calls and 4.3 s after (wall 45.7 s and 42.4 s, one run each on a loaded host). The manifests written are identical.
This commit is contained in:
Abdessamad Derraz committed 2026-11-06 09:11:37 +01:00
1 parent 9633ce3dd4
commit 462b61a4bc
3 files changed
+26 -12

No files matched your search

+10
View File
@@ -1231,6 +1231,16 @@ class AnExtraBesideItsDeclarationBelowTheBiosFolder(unittest.TestCase):
)
return {m for m in record.members if m.startswith("bios/")}
def test_the_slot_choices_are_computed_once(self):
"""pack_overrides recomputed the choices the manifest had just
computed with the same arguments: 8% of a manifest run."""
import slots
real = slots.slot_choices
with mock.patch.object(slots, "slot_choices", side_effect=real) as counted:
self._manifest(None)
self.assertEqual(counted.call_count, 1)
def test_the_pack_and_the_installer_drop_the_same_files(self):
full = self._manifest(None)
files, _omitted = install.narrow(