Programmatically generating cells vs static definition in Python

15 Aug 2017

[ python  performance  timeit  ]

Here is a link to a discussion on Treehouse which points out several issues related to the performance difference between programmatically generating cells vs static definition, as used for a game: Programmatically Generate CELLS

Gives an example of using the timeit function to compare the performance of programmatically generating a 4x4 grid of cells versus hard-coding the static definition. In this case, the static definition was about 23 times faster to execute.