You can use mesh.setEnabled(false) and  mesh.setEnabled(true)  instead of isVisible. The method setEnabled takes the mesh out of the rendering loop and so does not consume processing time. Whereas isVisible hides the mesh but keeps it in the rendering loop.