Skip to content

Commit d92e643

Browse files
Make the benchmark suite self-contained (drop the StableRNGs dependency)
The `Benchmarks` CI job errored with `ArgumentError: Package StableRNGs not found in current path`. AirspeedVelocity's `benchpkg` benchmarks each revision in a bare environment containing only the package under test (it does not read `benchmark/Project.toml` — `project_toml` is `nothing`), so `using StableRNGs` in `benchmark/benchmarks.jl` could never resolve. Replace StableRNGs with a tiny vendored SplitMix64 stream (`_bench_rand`) mapped to Float64 in [0, 1). It is deterministic across Julia versions and branches — all the base-vs-PR comparison needs — and pulls in no packages, so the suite runs in the environment benchpkg builds. Also fix the workflow path filter: it watched `bench/**`, but the suite lives in `benchmark/**`, so benchmark-only changes never triggered the job. Verified in a bare env (only FindFirstFunctions + BenchmarkTools, no StableRNGs): the suite loads, builds all groups, and runs a benchmarkable. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FvBXVKGujjeaCB3iLwsDeG
1 parent f7317fe commit d92e643

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

.github/workflows/Benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
paths:
66
- "src/**"
7-
- "bench/**"
7+
- "benchmark/**"
88
- "Project.toml"
99
- ".github/workflows/Benchmark.yml"
1010
workflow_dispatch:

benchmark/benchmarks.jl

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,52 @@
55

66
using BenchmarkTools
77
using FindFirstFunctions
8-
using StableRNGs
98

109
const SUITE = BenchmarkGroup()
1110

11+
# Dependency-free deterministic RNG (SplitMix64 mapped to Float64 in [0, 1)).
12+
# AirspeedVelocity benchmarks each revision in a bare environment containing
13+
# only the package under test, so the suite must not pull in extra packages;
14+
# this stream is deterministic across Julia versions and branches, which is
15+
# all the base-vs-PR benchmark comparison requires.
16+
function _bench_rand(n::Integer, seed::Integer)
17+
out = Vector{Float64}(undef, n)
18+
s = UInt64(seed)
19+
@inbounds for i in 1:n
20+
s += 0x9e3779b97f4a7c15
21+
z = s
22+
z = (z (z >> 30)) * 0xbf58476d1ce4e5b9
23+
z = (z (z >> 27)) * 0x94d049bb133111eb
24+
z = z (z >> 31)
25+
out[i] = (z >> 11) * (1.0 / (UInt64(1) << 53))
26+
end
27+
return out
28+
end
29+
1230
# Helper: build a sorted Float64 vector with the given pattern.
1331
function _make_v(kind, n, seed = 2026)
14-
rng = StableRNG(seed)
1532
return if kind === :uniform
1633
collect(range(0.0, Float64(n); length = n))
1734
elseif kind === :logspaced
1835
collect(exp.(range(0.0, log(1.0e6); length = n)))
1936
elseif kind === :random_sorted
20-
sort!(rand(rng, n) .* n)
37+
sort!(_bench_rand(n, seed) .* n)
2138
else
2239
error("unknown v kind $kind")
2340
end
2441
end
2542

2643
function _make_q(v, m, kind, seed = 2027)
27-
rng = StableRNG(seed)
2844
return if kind === :dense
2945
collect(range(first(v), last(v); length = m))
3046
elseif kind === :sparse
31-
sort!(first(v) .+ rand(rng, m) .* (last(v) - first(v)))
47+
sort!(first(v) .+ _bench_rand(m, seed) .* (last(v) - first(v)))
3248
elseif kind === :clustered
3349
j = max(1, length(v) ÷ 4)
3450
lo = v[j]
3551
hi = v[min(j + 1, length(v))]
3652
span = hi - lo
37-
sort!(lo .+ rand(rng, m) .* max(span, 1.0))
53+
sort!(lo .+ _bench_rand(m, seed) .* max(span, 1.0))
3854
else
3955
error("unknown q kind $kind")
4056
end

0 commit comments

Comments
 (0)