Pixels array p5.js vs java improving speed

Diff. from Processing Java, where color is just a 32bit value, p5js creates a heavy p5.Color object every time we invoke color(), fill(), stroke(), etc.

As a workaround we can pre-create a palette[] array filled w/ p5.Color objects.

For pixels[] in particular, we can even pre-create an array of 32bit values, as I did on my sketch version.

1 Like