They actually don't do the same thing at all.
In the Visible='on' case, the pixels are already sitting in the framebuffer on the graphics card. The getframe function just fetches them.
In the Visible='off' case, there is no framebuffer and the graphics haven't already been drawn. So the getframe command basically starts a print job. Printing is nearly as tightly optimized as on screen rendering because it supports lots of additional features that you're not using here. For one thing, it needs to allocate a number of resources which are basically free when you're drawing into the framebuffer.