Opam list very slow on opam 2.5

I recently upgraded from ubuntu 24.04 to 26.04 and thus from (I presume) opam 2.1 to 2.5.

It appears that Emacs takes a very long time to start due to user-setup’s opam-detect-installed-tools, which does opam list --installed --short --safe --color=never to get the list of tools for which it can do some configuration.

Indeed, running this command directly in a shell gets a “processing” message for several seconds, with an indication related to the repos. But there is no real need to interact with the repos to get the list of installed packages.

Can somebody reproduce this ?

I was going to write that I can’t reproduce, but testing this I discovered I hadn’t finished upgrading opam to 2.5.1 and then after upgrading I could reproduce:

$ time opam list --installed --short --safe --color=never >/dev/null

real	0m0.196s
user	0m0.156s
sys	0m0.040s
$ opam --version
2.5.0
$ time opam list --installed --short --safe --color=never >/dev/null # after upgrading opam

real	0m2.308s
user	0m1.683s
sys	0m0.401s
$ opam --version
2.5.1

Does the situation improve if you do it once without the --safe ? I feel it got better for me after that but still slower than it used to be

``real 0m0,619s user 0m0,483s sys 0m0,134s ``