by returningfory2 · 3mo ago · 0 comments
I think yours works. Alternatively in the loop:
if out.len() < n {
out.push(0);
}
out[n] = x;
n += (x > threshold) as usize;
In this case the if will be predicted well because it only triggers log(N) times, given how the std lib extends vectors.No comments yet.