build(dev): generate a 50k-track library and measure a running app
Plan 007 phase 4 is verified by measurement, not by assertion, and there was no way to produce a number: the fixture library is a few dozen tracks and cannot show any of the findings. - `cmd/gentestdata -bulk N` (`make bulkdata`) writes a ~50 000-track library in 11 s / 466 MB by encoding six clips once and copying them, while still tagging every file through `backend/tagwriter` — a library the app cannot read back measures nothing. - `make sandbox-seed-bulk` seeds from it through the same script and the same discipline as any other seed: by running the app and waiting for the real scan. - `e2e/perf/measure.mjs` (`make perf LABEL=x`, `make perf-compare`) takes fourteen measurements against a running app and writes them to a gitignored `.dev/perf/<label>.json`. It wraps every bound Go method, so "did that refetch the library" is a fact rather than an inference, and records `longtask` entries, which is where a 25 MB JSON parse on the main thread shows up and nowhere else. It is not a spec and does not run in CI.
This commit is contained in:
+33
-1
@@ -13,6 +13,11 @@
|
||||
//
|
||||
// go run ./cmd/gentestdata # generate if out of date
|
||||
// go run ./cmd/gentestdata -force # regenerate unconditionally
|
||||
// go run ./cmd/gentestdata -bulk 50000 # the measurement library
|
||||
//
|
||||
// The -bulk library is a separate thing with a separate purpose; see
|
||||
// bulk.go. It is not committed, not a test dependency, and generating
|
||||
// it does not regenerate the fixture library.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -44,6 +49,9 @@ func main() {
|
||||
brokenDir string
|
||||
manifestOut string
|
||||
force bool
|
||||
bulkTracks int
|
||||
bulkOut string
|
||||
bulkCover int
|
||||
)
|
||||
|
||||
flag.StringVar(
|
||||
@@ -62,9 +70,33 @@ func main() {
|
||||
&force, "force", false,
|
||||
"regenerate even when the manifest is already up to date",
|
||||
)
|
||||
flag.IntVar(
|
||||
&bulkTracks, "bulk", 0,
|
||||
"generate a bulk measurement library of N tracks instead",
|
||||
)
|
||||
flag.StringVar(
|
||||
&bulkOut, "bulk-out", ".dev/music_library_bulk",
|
||||
"library root for -bulk (gitignored; not a test fixture)",
|
||||
)
|
||||
flag.IntVar(
|
||||
&bulkCover, "bulk-cover-px", bulkCoverPx,
|
||||
"edge length of the embedded cover art for -bulk",
|
||||
)
|
||||
flag.Parse()
|
||||
|
||||
if err := run(outDir, brokenDir, manifestOut, force); err != nil {
|
||||
var err error
|
||||
|
||||
if bulkTracks > 0 {
|
||||
err = generateBulk(bulkSpec{
|
||||
Out: bulkOut,
|
||||
Tracks: bulkTracks,
|
||||
CoverPx: bulkCover,
|
||||
}, force)
|
||||
} else {
|
||||
err = run(outDir, brokenDir, manifestOut, force)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "gentestdata:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user