@@ -69,11 +69,6 @@ if #members == 0 then
6969 table.sort (members )
7070end
7171
72- if shardCount <= 1 then
73- print (table.concat (members , " " ))
74- return
75- end
76-
7772-- ── measured times ────────────────────────────────────────────────────────
7873-- Format: <platform>\t<member>\t<seconds>
7974local times , samples = {}, {}
@@ -96,6 +91,43 @@ if #samples > 0 then
9691 median = samples [math.ceil (# samples / 2 )]
9792end
9893
94+ -- ── run order: cheapest first ─────────────────────────────────────────────
95+ --
96+ -- Packing and ORDER are different questions. LPT has to consider members
97+ -- descending or the bins come out lopsided, and that stays exactly as it was;
98+ -- this only decides the sequence a shard hands to run_members.sh.
99+ --
100+ -- Cheapest first so that BREADTH is covered early, and a maintainer can act on
101+ -- the run before it finishes.
102+ --
103+ -- That is the reason, and it is a deliberate one: occasionally a change is
104+ -- worth merging once the core is demonstrably covered, without waiting out the
105+ -- tail. A full linux run is 13427s of member wall-clock and four members are
106+ -- 52% of it (grpc-codegen 3363s, grpc-module 1724s, opencv-module-dnn 1017s,
107+ -- protobuf-protoc 945s). Ordered this way, ~55 members have reported before
108+ -- the first heavyweight even starts — so "everything but the four known
109+ -- expensive ones is green" is a state that exists, early, and can be judged.
110+ -- With the expensive members leading, the run has no such intermediate state:
111+ -- it is uninformative for an hour and then complete.
112+ --
113+ -- Read the consequence the same way. A shard that hits its timeout now loses
114+ -- the expensive members rather than the cheap ones — which is the half a
115+ -- maintainer would choose to skip anyway, few in number and named in
116+ -- tests/member-timings.tsv.
117+ local function cheapest_first (list )
118+ table.sort (list , function (a , b )
119+ local ta , tb = times [a ] or median , times [b ] or median
120+ if ta ~= tb then return ta < tb end
121+ return a < b -- deterministic across machines
122+ end )
123+ return list
124+ end
125+
126+ if shardCount <= 1 then
127+ print (table.concat (cheapest_first (members ), " " ))
128+ return
129+ end
130+
99131-- ── dependency signature, for affinity ────────────────────────────────────
100132local function deps_of (member )
101133 local toml = read_file (" tests/examples/" .. member .. " /mcpp.toml" )
@@ -165,4 +197,5 @@ if os.getenv("PLAN_SHARDS_DEBUG") then
165197 end
166198end
167199
168- print (table.concat (shards [shardIndex ] and shards [shardIndex ].members or {}, " " ))
200+ print (table.concat (
201+ cheapest_first (shards [shardIndex ] and shards [shardIndex ].members or {}), " " ))
0 commit comments