With ~10000 links a nix-collect-garbage no-op takes ~1 min.
It's pretty bad. If it gets any worse I might need to give up the pure file system approach, use sqlite and just place the deduplicated links instead.
Using the filesystem as a database was a bad idea in general. Fixed in 3aea6d0b40b1660ea4034682b511c3f3bf4c6a95, now I use json. Might switch to sqlite later.