Importing a package can be very slow with a big management repo

I noticed that importing a ton of packages in my management repo can be very slow (a new management repo is created for new packages and it is merged into the existing management repo when the importing is done).

Some quick benchmarking:

0 existing packages:

$ time pdm run repod-file -c ../repod.conf repo importpkg bash-5.1.016-1-x86_64.pkg.tar.zst community

real    0m1,164s
user    0m1,013s
sys     0m0,143s

100 existing packages:

time pdm run repod-file -c ../repod.conf repo importpkg bash-5.1.016-1-x86_64.pkg.tar.zst community                                                                                                        

real    0m4,552s
user    0m4,377s
sys     0m0,154s

1000 existing packages:

time pdm run repod-file -c ../repod.conf repo importpkg bash-5.1.016-1-x86_64.pkg.tar.zst community

real    0m25,897s
user    0m25,299s
sys     0m0,458s

5000 existing packages:

time pdm run repod-file -c ../repod.conf repo importpkg bash-5.1.016-1-x86_64.pkg.tar.zst community

real    2m29,775s
user    2m27,144s
sys     0m1,772s
Edited by Kristian Klausen