Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Time redraw of an image
Red [needs: view] ;) run as `red --cli ...` to eliminate GUI console influence!
img: make image! 2000x1000 ;) need a big enough image
system/view/auto-sync?: no ;) disable auto-update so we can profile it
view [
panel [
base font-color black "CHASE THE MOUSE AROUND" 1000x500 img
all-over on-over [
t0: now/precise
face/image/(10x10): random white ;) update the image
show face/parent ;) then force redraw
; show face ;) this one reports false time 0-1 ms while being just as slow!
print [to float! 1000.0 * difference now/precise t0 "ms to redraw"]
]
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment