BTW, for sorting currently xref-search-program-alist uses:
"| sort -t: -k1,1 -k2n,2"
but fortunately ripgrep has a special option to do the same with:
"--sort path"
Somehow, that option came out to be consistently slower in my
benchmarking. Even when the results are only a few lines (that's actually
when the difference should be most apparent, because with many lines Elisp
takes up the most of CPU time). You can try it yourself:
(benchmark 10 '(project-find-regexp ":package-version '(xref"))
0.86 with '| sort'
1.33 with '--sort path'