single vs double buffering

Which one will be more faster single vs double buffer? and how? Is there any reason to use single buffer? We can avoid tearing effect in double buffering but what if we use glFlush(), would it work?

I am unaware of any method to avoid tearing using single buffering. Using single buffering has additional problems. For example if rendering a simple rotating cube with different colored faces and z-buffering, some of the faces that would be hidden upon completion of drawing can temporarily be visible using single buffering. This can be fixed by rendering to Framebuffer objects, then drawing that to the front buffer. But, then it is just a roundabout method of double buffering.

The amount of time of spent managing buffers when using double buffering is super tiny, small fractions of a millisecond. So drawing nothing and swapping buffers can be done easily of 10,000 frames per second, causing tearing multiple times per scan line. When removing tearing, then the maximum frame rate would be a much smaller number, say 60/120/144 frames per second. So, I could not imagine single vs double buffering being any sort of performance issue to consider.

The only way to use single-buffering without flickering would be if you could reliably draw the entire frame within the vertical blank period. Or if you could order the rendering so as to follow the vertical scan, and could reliably draw the entire frame within the refresh interval. Neither of these are realistic approaches.

Note that flickering and tearing are different things. Single buffering results in flickering (where scan-out sends part of frame which is in the process of being rendered to the monitor), double buffering without waiting for vertical sync results in tearing (where scan-out switches from one complete frame to the next in the middle of a frame rather than between frames).

The main use case for single buffering is the case where you are displaying a static scene which only changes in response to specific events (i.e. not animation), and redraw takes a significant amount of time. In that situation, single buffering allows you to redraw only geometry which has changed (that won’t work with double buffering because the contents of the back buffer are undefined after a swap).

IOW, it’s useful mostly for CAD-type programs on ancient hardware where being able to avoid a full redraw is more important than the redraw operation being visible.