Tabulate_tensor_integral becomes a performance hotspot when simulation moves from 2D to 3D

Two things change in 3D, you get more degrees of freedom per element (larger local matrix) and you get another quadrature rule (more points required to do the numerical integral).

You can control the latter, see for instance