While investigating T97368#4576389 I noticed that the particular query that I was looking at took over 30 seconds to finish executing according to the api.log
... [W5jEGwpAAK4AAKd9eigAAAAV] ... API POST ... T=31327ms action=wbsetqualifier format=json claim=Q56596767$BD081022-A6F4-4297-B7A2-484F2918094A property=P1932 value=%22A.%20Zucchetta%22 snaktype=value ... baserevid=744943483 bot=1
I recreated the edit to profile and the result can be seen on https://performance.wikimedia.org/xhgui/run/view?id=5b98dd85bb85446306a75aae
This appears to indicate that most of the time is spent in a single method in EntityContent:
Wikibase\EntityContent::collectValues@2 3,530,113 µs
We should investigate this and see if we can speed this code path up.
It would be great to create a copy of this item on our test wiki to benchmark against.