Expand description
What compiling once and invoking many times costs, counted.
Issue #109’s gate asks for a compile-once/invoke-many embedding measured on
the compiled backend, and for Host conversion measured beside it. This is
that measurement. It is a binary rather than a #[test] for one reason: it
installs a counting std::alloc::GlobalAlloc, and a count taken while
cargo test runs other cases on other threads would be a count of the
test harness. Nothing here runs under cargo test, and the counts the
README quotes were taken by running it.
cargo run --release -p cove-rules --bin cove-rules-measure -- 2000§What is a count and what is a time
The allocation counts and the instruction counts are exact and are the same
on every machine: they come from a counter incremented on the path, not
from a sampler. The wall times are medians over the turns of one process
and are worth what any wall time taken on a shared machine is worth, which
is the ratios between rows measured in the same run and not the absolute
figures. examples/rules/README.md says which of its numbers is which.
§The rows, and what each isolates
Each entry is a control on the one below it.
rules.floordoes nothing, so it is what an invocation costs before the program does anything: finding the entry, entering the frame, and answering.rules.decideSampleruns the whole rule catalog over a pull request the package itself holds, and makes no Host API call at all.rules.embedded.evaluateruns the same catalog over a pull request the host built and handed over as an argument, so what it adds todecideSampleis the argument and nothing else.rules.embedded.pullOnlymakes one Host API call and converts what comes back into the package’s own struct, and weighs nothing.rules.embedded.decideRequestdoes both, and reports the decision back through a second call.
The middle three are the point. evaluate and decideRequest reach the
same decision over the same pull request, one with it as an argument and
one with it fetched across the Host API boundary, so the difference between
them is what the boundary was costing an embedding that had no other way in
(issue #150).
The Rust side is measured on its own beside them: PullRequest::to_policy
builds the value an invocation hands over — the same ten fields
to_cove builds for the boundary — and Decision::from_cove reads the one
that comes back.
Structs§
- Cost 🔒
- What one measured stretch of work cost.
- Counting 🔒
- The system allocator, counting what goes through it.
- Row 🔒
- One row of the report: what a thing cost, divided by how many times it was done.
Enums§
- Way 🔒
- Which way into the program a row is measuring.
Statics§
- ALLOCATIONS 🔒
- Allocations made since the process started.
- BYTES 🔒
- Bytes those allocations asked for.
- COUNTING 🔒