Say why the fixture is kept on the device instead of shipped as an archive

Fair question, and the answer is a measurement rather than a preference. A tarball of the fixture is tiny - 7 KB for a thousand empty files, ~150 KB for twenty thousand - so shipping it costs nothing in bytes. It saves nothing in time either: 1000 files take 32.8 s to create with the shell loop and 39.6 s to extract from a tarball on the same phone, because the cost is a per-file round trip into the storage layer rather than the bytes or where they came from. .nomedia, which should have kept the media scanner away, made creation slower still at 46.8 s.

So the useful policies are the ones already in place - reuse the folder that is there, and build the size the question actually needs - and PERFORMANCE.md now records the two negative results so nobody spends an afternoon rediscovering them.
This commit is contained in:
2026-10-17 22:08:53 +02:00
parent 8db76c6e82
commit 2a40302982
+10
View File
@@ -208,6 +208,16 @@ And the fixture now survives: `tools/benchmark-fixture.sh --count 20000` reuses
at least that many files, and `--fresh` rebuilds it. Building it takes about half an hour through MIUI's at least that many files, and `--fresh` rebuilds it. Building it takes about half an hour through MIUI's
storage layer, which is the whole reason to keep it. storage layer, which is the whole reason to keep it.
**Why it is kept on the device rather than shipped as an archive.** The obvious refinement — tar the folder
once, push it, extract it on a fresh device — was measured and does not help: 1 000 empty files take 32.8 s
to create with the shell loop and **39.6 s** to extract from a tarball on the same phone. The cost is a
per-file round trip into the storage layer, not the bytes or the source (the tarball itself is 7 KB for
1 000 files, ~150 KB for 20 000). `.nomedia` in the folder, which would keep the media scanner away, made
creation *slower* (46.8 s), so the scanner was not the culprit either.
What that leaves is: reuse the folder that is already there, and if a device is wiped, build the size you
actually need — 1 000 takes half a minute, 5 000 a few minutes, 20 000 half an hour.
Building that fixture is the expensive part, not measuring it: 20 000 files took about thirty minutes Building that fixture is the expensive part, not measuring it: 20 000 files took about thirty minutes
through MIUI's storage layer (`: >` in a loop), against roughly four minutes of benchmark on top. Worth through MIUI's storage layer (`: >` in a loop), against roughly four minutes of benchmark on top. Worth
knowing before anyone re-creates it, and an argument for the fixture being built once and kept. knowing before anyone re-creates it, and an argument for the fixture being built once and kept.