import profile, pygame
def main():
pygame.init()
screen = pygame.display.set_mode((310,120))
pygame.display.set_caption("aaaa")
pygame.mouse.set_visible(1)
profile.run("main()")
3 function calls in 0.268 CPU seconds
it was quite fast here
Looks like the most expensive part might be the import pygame:
With your code:
3 function calls in 0.688 CPU seconds
Or like this (and after restarting the interpreter):