Formerly resolve_xref() in Sphinx extension called get_objects() from Sphinx API which subsequently iterated the whole list of objects, causing single iteration per single reference, which is essentially. O(n^2). Avoid using get_objects() and access internal dictionary directly intead. The docs build time was still dominated by other factors but speedup is about 10 % on my machine.