Last active
August 15, 2022 00:09
-
-
Save GiuseppeChillemi/69b83e4f3f8f74b3599dd25212e851b2 to your computer and use it in GitHub Desktop.
Testing GETTIN Speeds (Now with 8 tests !!!)
This file contains 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 [] | |
Rebol [] | |
recycle/off | |
;This code is from Ashley Graham | |
platform?: case [ | |
2 = system/version/1 ['Rebol] | |
not rebol ['Red] | |
system/product = 'atronix-view ['Atronix] | |
] | |
Probe "Testing GETTING Speeds" wait 1 | |
o: make object! [a: 22] | |
Print ["S1 - GET-IN: " s1: dt [loop 10000000 [get in o 'a]]] | |
wait 1 | |
Print ["S2 - PATH: " s2: dt [loop 10000000 [o/a]]] | |
wait 1 | |
Print ["S3 - GET WORD!: " s3: dt bind [loop 10000000 [get 'a]] o] | |
wait 1 | |
Print ["S4 - DIRECT WORD REDUCING: " s4: dt bind [loop 10000000 [a]] o] | |
wait 1 | |
Print ["S5 - PATH and GET-WORD o/:w : " s5: dt [w: 'a loop 10000000 [o/:w]]] | |
wait 1 | |
recycle/off | |
;This code is from Ashley Graham | |
platform?: case [ | |
2 = system/version/1 ['Rebol] | |
not rebol ['Red] | |
system/product = 'atronix-view ['Atronix] | |
] | |
Print "Testing GETTING Speeds" wait 1 | |
o: make object! [a: 22] | |
Print ["S1 - GET-IN> [get in o 'a] : " s1: dt [loop 10000000 [get in o 'a]]] | |
wait 1 | |
Print ["S2 - PATH> [o/a] :" s2: dt [loop 10000000 [o/a]]] | |
wait 1 | |
Print ["S3 - GET WORD!> [get 'a] : " s3: dt bind [loop 10000000 [get 'a]] o] | |
wait 1 | |
Print ["S4 - DIRECT WORD REDUCING> [a] : " s4: dt bind [loop 10000000 [a]] o] | |
wait 1 | |
Print ["S5 - PATH and GET-WORD> [o/:w] : " s5: dt [w: 'a loop 10000000 [o/:w]]] | |
wait 1 | |
Print ["S6 - PATH and GET-WORD in PARENS> [o/(w)] : " s6: dt [w: 'a loop 10000000 [o/(w)]]] | |
wait 1 | |
Print ["S7 - DIRECT GET-WORD> [:a] :" s7: dt bind [loop 10000000 [:a]] o] | |
wait 1 | |
Print ["S8 - DIRECT PARENS GET-WORD> [(a)] :" s8: dt bind [loop 10000000 [(:a)]] o] | |
if platform? = 'rebol [ | |
s1: to-decimal s1 | |
s2: to-decimal s2 | |
s3: to-decimal s3 | |
s4: to-decimal s4 | |
s5: to-decimal s5 | |
s6: to-decimal s6 | |
s7: to-decimal s7 | |
s8: to-decimal s8 | |
] | |
Print ["---------Differences-----------"] | |
Print ["GET IN vs PATH (s1/s2): " 100 - ((s1 / s2) * 100) "%"] | |
Print ["GET IN vs GET (s1/s3): " 100 - ((s1 / s3) * 100) "%"] | |
Print ["PATH VS GET (s2/s3): " 100 - ((s2 / s3) * 100) "%"] | |
Print ["GET IN vs DIRECT WORD REDUCING (s1/s4): " 100 - ((s1 / s4) * 100) "%"] | |
Print ["GET vs DIRECT WORD REDUCING (s3/s4): " 100 - ((s3 / s4) * 100) "%"] | |
Print ["PATH vs GET-WORD o/:w (s2/s5): " 100 - ((s2 / s5) * 100) "%"] | |
Print ["WORD vs GET-WORD (s4/s7): " 100 - ((s4 / s7) * 100) "%"] | |
Print ["WORD vs GET-WORD in parens (s4/s8): " 100 - ((s4 / s8) * 100) "%"] | |
recycle/on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment