Skip to content

Instantly share code, notes, and snippets.

@hiiamboris
Created May 22, 2020 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiiamboris/6b77a58ae549b6af413b494a416b3b01 to your computer and use it in GitHub Desktop.
Save hiiamboris/6b77a58ae549b6af413b494a416b3b01 to your computer and use it in GitHub Desktop.
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