Skip to content

Instantly share code, notes, and snippets.

@hinjolicious
Last active August 15, 2026 07:24
Show Gist options
  • Select an option

  • Save hinjolicious/8ec01fa64fa448c54f7e59e51ba97fdc to your computer and use it in GitHub Desktop.

Select an option

Save hinjolicious/8ec01fa64fa448c54f7e59e51ba97fdc to your computer and use it in GitHub Desktop.
Red's Draw vs Direct Pixel Performance
Red [
Title: "Red's Draw vs Direct Pixel Performance"
Needs: 'View
]
system/view/auto-sync?: off ; <-- TO MAKE PIXEL MANIPULATION ON IMAGE FASTER!!!
w: 80
h: 80
blk: copy []
img: make image! as-pair w h
win: view/no-wait/no-sync [
title "Red's Graphic Performance "
panel [ info1: text "fps" return canv1: base 80x80 draw blk ]
panel [ info2: text "fps" return canv2: image img ]
]
fps1: fps2: 0
t0: now/time/precise
c: 0.0.0
; draw dialect
t: 0.0
loop 50 [
clear blk
repeat y h [
repeat x w [
c/1: to integer! ((sin (x * 0.1 + t)) + 1 * 127.5)
c/2: to integer! ((sin (y * 0.1 + (t * 1.3))) + 1 * 127.5)
c/3: to integer! ((sin ((x + y) * 0.08 + t)) + 1 * 127.5)
append blk compose [pen (c) box (p: as-pair x y) (p)]
]
]
t: t + 0.1
show canv1 do-events/no-wait
fps1: fps1 + 1
if now/time/precise - t0 > 0:0:1 [
info1/text: rejoin ["fps: " form fps1]
fps1: 0
t0: now/time/precise
]
]
; direct pixel
t: 0.0
loop 50 [
idx: 1
repeat y h [
repeat x w [
c/1: to integer! ((sin (x * 0.1 + t)) + 1 * 127.5)
c/2: to integer! ((sin (y * 0.1 + (t * 1.3))) + 1 * 127.5)
c/3: to integer! ((sin ((x + y) * 0.08 + t)) + 1 * 127.5)
poke img idx c
idx: idx + 1
]
]
t: t + 0.1
show canv2 do-events/no-wait
fps2: fps2 + 1
if now/time/precise - t0 > 0:0:1 [
info2/text: rejoin ["fps: " form fps2]
fps2: 0
t0: now/time/precise
]
show info1
show info2
]
print "done"
@hinjolicious

Copy link
Copy Markdown
Author
GIF 8-15-2026 1-18-47 AM

@Oldes

Oldes commented Aug 14, 2026

Copy link
Copy Markdown

Try it with: system/view/auto-sync?: off

@hinjolicious

Copy link
Copy Markdown
Author

I have updated the code above. This is the result now:
GIF 8-15-2026 1-50-32 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment