Last active
August 15, 2026 07:24
-
-
Save hinjolicious/8ec01fa64fa448c54f7e59e51ba97fdc to your computer and use it in GitHub Desktop.
Red's Draw vs Direct Pixel Performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
commented
Aug 14, 2026
Author
Try it with: system/view/auto-sync?: off
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
