When Saxon, in schema-aware mode, compiles a path expression in a query or stylesheet, it makes a check that elements named in the path expression can actually appear in the schema-defined content model of the context item's type. In the case where the context item's type is a complex type from which many other types have been derived by extension, directly or indirectly, this check may take an inordinately long time. What is actually happening is that Saxon iterates over the types derived by extension from the original type T, then recursively over the types derived by extension from each of these types, and so on; however, the original list of types derived by extension is already the transitive closure, so this involves visiting the same types many times over.
A patch is being raised for this problem in both the 9.1 and 9.2 branches. The main impact is on the class UserComplexType, which is Saxonica-private code; however it also involves changing the signature of the method ComplexType.getElementParticleCardinality(), which is in open-source code.