New user `update()` function feature

The next version of py5 will support a user update() function. This function will be called before each call to draw().

The purpose of this new update() function is to provide an opportunity to execute Python code in the small gap of time between one call to draw() and the next. Normally this isn’t a large amount of time, perhaps 10-15% of the total execution time, but for py5, that’s time when the Python interpreter would otherwise be is idle. The update() function provides an opportunity to execute Python code during that time, and in a lot of cases can yield a 5-10% increase in the Sketch’s frame rate.

You can read more about it here:

Happy to hear your thoughts and feedback!

1 Like