rad experiment show 0148858a05cbfd1838c2b20f27e65b974ca9e358
by ee@did:key:z6MkvsiybCuk1WDZhh2aXDx7NTiZejKgWZygMNsUuXDMNvVQ · Apr 11 15:03 2026
pre-filter repos without experiment COB refs
Measurements
Metric
BaselineThe benchmark measurement of the unmodified code
CandidateThe code with the proposed optimization applied
DeltaThe performance change from baseline to candidate
index_page_latency (ms)primary
230.934 ms (n=1)
215.218 ms (n=1)
-6.80%
index_page_bytes (bytes)secondary
83284.000 bytes (n=1)
83284.000 bytes (n=1)
0.00%
Annotations
hypothesis
55% of seeded repos have no experiments; Experiments::open(repo).all() still pays to enumerate type refs per repo. libgit2 glob check is cheaper.
profile_signal
diagnostic showed 16/29 empty; the existence check is a single git reference_glob call.
what_worked
-6.8% latency. Wins on empty repos were smaller than predicted — empty repos only cost ~1 ms each because Store::list short-circuits at empty types(). Still clear improvement and zero-risk.
Base CommitThe starting commit before the optimization was applied
2028 let Ok(payload) = doc.doc.project() else {
2029 continue;
2030 };
2031+ // Skip repos with no experiment COBs before paying the cost of
2032+ // `Experiments::open(...).all()`, which walks the COB change graph
2033+ // for every experiment. On a seed serving many repos, over half may
2034+ // have zero experiments; the libgit2 glob check is ~free.
2035+ let has_any_experiment_cob = repo
2036+ .raw()
2037+ .references_glob("refs/namespaces/*/refs/cobs/cc.experiment/*")
2038+ .ok()
2039+ .map(|mut it| it.next().is_some())
2040+ .unwrap_or(false);
2041+ if !has_any_experiment_cob {
2042+ continue;
2043+ }
2044 let experiments = match Experiments::open(&repo) {
2045 Ok(e) => e,
2046 Err(_) => continue,