perf: replace list operation with numpy function
We improve the performance of the compute_betas_and_lengths
function by replacing the line
[all_s.tolist().index(e) for e in set(all_s)]
with
np.unique(all_s, return_index=True)
This line compute the indices of the unique elements of all_s
.
The new version is faster.