Performance: draw_primitive() vs set_pixel()

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Lempf

Hello,
I have a screen size of (384, 216) and want to generate a pixelated image on it at runtime. (randomly generated pixel positions and colors)

So I found out I can either use draw_primitive() and / or an Images set_pixel(), with handing this to an ImageTexture and a Sprite.

The latter sounds more natural as I want to set pixels of an image.
Is there any best practice for this, also performance wise?