Increase Solve Time With Custom Mesh

I am using gmsh to create custom 3D meshes that are periodic on all sides but the top and bottom. I have been running into a problem that when I use the mesh created by gmsh it takes and order of magnitude longer to solve than if I use a box mesh in FEniCS.

I am doing a manual assemble and then solve and it seems that using the custom mesh only increases the solve step, not the assembling step or when I apply boundary conditions.

I am using pygmsh to create the mesh and then meshio to port it over to an xdmf file formate using the following code:

 meshio.write('./mesh.xdmf', meshio.Mesh(points=mesh.points, cells={"tetra": mesh.cells["tetra"]}))

In my program I am solving in two different function spaces:

V = d.FunctionSpace(self.mesh, "Lagrange", self.order, constrained_domain=pbc)


U = d.FunctionSpace(self.mesh, "RT", self.order, constrained_domain=
Q = d.FunctionSpace(self.mesh, "N1curl", self.order+1, constrained_domain=pbc)
Uelem = U.ufl_element()
Qelem = Q.ufl_element()
QU = d.FunctionSpace(self.mesh, Qelem * Uelem, constrained_domain=pbc) 

It is the QU function space that is having the issue with the solve step.