Quick answer: Use pygame.display.flip() for full-screen updates when most of the screen changes each frame. Use pygame.display.update(rect_list) with dirty rectangles when only small regions change. Passing a rect list to update() avoids redrawing the entire screen and can dramatically improve frame rates for UI-heavy or turn-based games.

Here is how to fix Pygame display.flip vs display.update performance. Your game runs at 60 FPS with a simple background, but adding a few more sprites drops it to 30. Or your card game redraws the entire 1920x1080 screen every frame just to animate one card moving. Pygame’s two display update functions look interchangeable but have very different performance characteristics depending on how much of the screen actually changes each frame.

The Symptom

Frame rate drops as resolution or sprite count increases. Profiling shows most time is spent in the display update call, not in game logic or drawing. The game feels sluggish on lower-end hardware even though the scene is visually simple.

Variant: switching from flip() to update() with no arguments makes no difference (because they do the same thing when called without arguments). Or dirty-rect rendering produces visual artifacts because old frames are not cleared properly.

What Causes This

Using flip() when only part of the screen changes. pygame.display.flip() pushes the entire screen buffer to the display. For a 1080p window, that is ~8 MB of pixel data copied per frame. If only a 100x100 sprite moved, 99.5% of that copy was wasted.

Using update() without arguments. pygame.display.update() with no arguments is identical to flip() — it updates the entire screen. The performance benefit only comes when you pass a list of rectangles that changed.

Not tracking dirty rectangles. To use update(rect_list), you need to know which screen regions changed. Without tracking, you either update everything (no gain) or update too little (visual artifacts).

Redrawing everything every frame unnecessarily. Many tutorials teach the pattern of clearing the entire screen with fill() and redrawing everything every frame. This works but wastes CPU when most of the scene is static.

The Fix

Method 1: Full flip for action games. When most of the screen changes every frame (scrolling, particles, many moving objects), full flip is the right choice. Optimize with double buffering:

import pygame
from pygame.locals import DOUBLEBUF

pygame.init()
screen = pygame.display.set_mode((1280, 720), DOUBLEBUF)
clock = pygame.time.Clock()

while True:
    # Clear and redraw everything
    screen.fill((0, 0, 0))
    draw_background(screen)
    draw_sprites(screen)
    draw_ui(screen)

    pygame.display.flip()  # full screen swap
    clock.tick(60)

The DOUBLEBUF flag enables double buffering, which swaps buffers instead of copying — faster on supported hardware.

Method 2: Dirty-rect update for static scenes. For games with mostly static backgrounds (board games, card games, menus):

import pygame

pygame.init()
screen = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()

# Draw background once
background = pygame.image.load("board.png").convert()
screen.blit(background, (0, 0))
pygame.display.flip()  # initial full draw

while True:
    dirty_rects = []

    for sprite in moving_sprites:
        # Erase old position by restoring background
        old_rect = sprite.rect.copy()
        screen.blit(background, old_rect, old_rect)
        dirty_rects.append(old_rect)

        # Update position
        sprite.update()

        # Draw at new position
        screen.blit(sprite.image, sprite.rect)
        dirty_rects.append(sprite.rect.copy())

    # Only update the regions that changed
    pygame.display.update(dirty_rects)
    clock.tick(60)

This updates only the rectangles where sprites moved. For a 1280x720 screen with one 64x64 sprite, you update ~8,192 pixels instead of 921,600 — a 112x reduction.

Method 3: Pygame sprite Groups with dirty tracking. pygame.sprite.RenderUpdates automates dirty-rect tracking:

all_sprites = pygame.sprite.RenderUpdates()

# Add sprites to group
player = Player()
all_sprites.add(player)

while True:
    all_sprites.update()

    # clear() restores background under each sprite
    all_sprites.clear(screen, background)

    # draw() returns list of dirty rects
    dirty = all_sprites.draw(screen)

    pygame.display.update(dirty)
    clock.tick(60)

RenderUpdates tracks both old and new positions and returns the minimal set of dirty rects. This is the most Pygame-idiomatic approach.

Measuring the Difference

Profile both approaches to see the actual impact:

import time

# Benchmark flip
start = time.perf_counter()
for _ in range(1000):
    screen.fill((0, 0, 0))
    pygame.display.flip()
flip_time = time.perf_counter() - start

# Benchmark dirty update
small_rect = pygame.Rect(0, 0, 64, 64)
start = time.perf_counter()
for _ in range(1000):
    pygame.display.update(small_rect)
dirty_time = time.perf_counter() - start

print(f"flip: {flip_time:.3f}s, dirty: {dirty_time:.3f}s")

On a 1080p display, dirty-rect update of a small region is typically 5–15x faster than a full flip.

“flip() for action. update(rects) for mostly-static scenes. Match the update strategy to how much actually changes.”

Related Issues

For surface transparency performance, see Pygame Surface Blit Alpha Not Transparent. For general rendering optimization, Best Bug Tracking for Solo Developers covers related development workflow tips.

Track dirty rects for static scenes. Use RenderUpdates for automatic tracking. Full flip when everything moves. Choose based on your game.