The following query takes longer to run than it should because of codegen time.
The size of the codegen module is excessive compared to the complexity of the query:
I dug into what was happening and the module is full of boost timestamp functions. It looks like most of this is coming from our implementation of Trunc(), which switches between a large number of different implementations.
I moved Trunc() out of the cross-compiled IR and codegen time was more sensible: