Closed
Description
versioninfo
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin22.4.0)
CPU: 10 × Apple M1 Max
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 on 8 virtual cores
Environment:
JULIA_LOAD_PATH = @:@stdlib
vs current master (b4f7263)
full MWE
using BenchmarkTools
using Base.Threads: @threads
using Random: shuffle
function sample_vote!(_rb, chop_counts)
pts = rand(length(chop_counts))
N = length(_rb)
_srt = 4245
partialsortperm!(_rb, pts, 1:_srt; lt = <, rev = true)
while sum(@views chop_counts[_rb[1:_srt]]) ≤ 5660
_srt = min(2 * _srt, N)
partialsortperm!(_rb, pts, 1:_srt; lt = <, rev = true)
end
end
function parallel_scores(chop_counts)
for k ∈ 1:8 # @threads in real code, but not needed for mwe. do need -t8 though
_rb = collect(1:length(chop_counts))
# the bigger this number, the more % GC time
for _ ∈ 1:1000
sample_vote!(_rb, chop_counts)
end
end
end
# kind of arbitrary, but approximates my data
chop_counts = shuffle(trunc.(Int, 6500 ./ (50:100_000)))
# @benchmark parallel_scores($(chop_counts)) evals = 1
note that the regression only appears on my machine when called with multiple threads, e.g. -t8
, even if I do not use them to multithread the loop