It seems your explanation makes me clear. Scan used a function defined by myself, which may drag down the sampling. Thank you for this information.
PyMC uses pytensor as a computational backend, which does lazy execution. Before you call pm.sample, nothing is computed; only a compute graph is constructed. This code will always execute quickly as a result – it’s totally independent of the complexity of the computation.