flutter_bench_contract 0.3.0
flutter_bench_contract: ^0.3.0 copied to clipboard
A performance contract for Flutter overlay/widget solutions: canonical device scenarios (idle cost, show/update latency, scroll coupling, heap retention, size), a one-sided golden gate, and published [...]
0.3.0 #
One command runs the whole contract. S7 size stopped being a second
CLI verb — it was already a scenario in the registry, the manifest
(scenarios: [..., size]) and the store, but contract run dead-ended on
it ("run contract size instead"). Now contract run executes the size
legs itself, once per manifest, when size is selected:
contract sizeremoved;rungained--legs native|web|both(defaultboth) so the device-free web leg still runs in plain CI without the emulator job.- Size metrics keep their OWN golden refs inside
run:bundle_deltais SDK-pinned underany;native_sizefollows the invocation ref (the docker dispatch records it underandroid). - The runner-image entrypoint collapsed to one
contract runinvocation (device scenarios + native size leg); card/readme renders unchanged.
0.2.0 #
Smart bench, dumb bridge. The S1–S7 scenario bodies now live ONCE in
lib/scenarios.dart instead of being copied into every consumer: the
package depends on flutter_test (precedent: golden_toolkit) so the bodies
can be published as code, not templates. contract init copies only ~8-line
per-scenario bridges that wire the consumer's driver into its own test
process. Consumers physically cannot edit the bodies anymore — a scenario
change is a package version bump, which makes the anti-tuning property
stronger. LibraryDriver moved into lib/driver.dart (public API); the
consumer's driver stays consumer-side because it imports the solution under
test.
lib/scenarios.dart—runContractScenario(id, driver:, idleClasses:)registers the S1–S7 (+S1r) bodies as tests; protocol constants stay the package's methodology.templates/removed; generated files are now the dumb bridges plus the flutter-drive test driver (test_driver/integration_test.dart, also generated now).contract initre-syncs the manifest'stemplate:key (previously it was only a header comment, socontract verifycould not detect stale generated files); template version bumped to 2.- Dead
bin/check_goldens.dartCLI removed (duplicatedcontract run's gate); internal extraction-history comments purged from all shipped files.
0.1.0 #
First release: the generic core of the bench contract, extracted from the hintful benchmark suite and generalized.
Measurement & gate core
collectors.dart—FrameWindow/collectFrames(frame timings) and VM-service heap probes (used-bytes medians after GC, top retained classes).report.dart— theHINTFUL_BENCH_JSON:envelope (reportMetric,parseSample), the median reducer, and run-report reading.goldens.dart— thebenchmarks.jsongolden store:record, one-sidedcheck(lower-is-better, per-ref),loadwith ref preference.
Contract machinery
LibraryDriverAPI + the neutral scene (buildContractScene,SceneSpec) — the only consumer-written code: scene building with the solution's own widgets and the scenario verbsshow/update/hide,isStable(),currentContent(),scrollCoupled.- Scenario templates S1–S7 (idle tree diff, idle resources with per-class
VM-service counting, show/update latency, scroll coupling, active heap,
hide retention, size) with in-scenario asserts — copied into the consumer
by
contract init, never edited by hand (template versioned in the manifest,contract verifychecks it). contractCLI:init,run(hostflutter testor deviceflutter drive --no-dds --profile),size,card,readme,verify.- Custom scenarios:
customScenarios:in the manifest — consumer-owned metrics undercustom.*ids with their own golden refs, excluded from rival comparisons and public tables. - Multi-library manifests (
libraries:): one scenario list, one driver per solution, per-solution golden refs — the head-to-head shape used by hintful'sbenchmark/compare.
Published results
defs.dart— canonical display metadata (label/unit) and value formatters shared by the card and the README table.metrics_card.dart— theMetricsCardwidget (title, tiles, note, legend) rendered bycontract cardinto a golden-checked PNG.readme.dart— genericrenderReadmeSectionfor the root-README "Performance" table between<!-- bench:start/end -->markers.- Manifest
card:/readme:sections — the consumer writes only the copy; layout, formatting, fonts and rendering belong to the package.