Skip to content

Instantly share code, notes, and snippets.

@GiuseppeChillemi
Last active August 14, 2022 23:27
Show Gist options
  • Save GiuseppeChillemi/56981a59cb74f5d57119ced529808f79 to your computer and use it in GitHub Desktop.
Save GiuseppeChillemi/56981a59cb74f5d57119ced529808f79 to your computer and use it in GitHub Desktop.
Test the difference of speed from having a datatype in a different position
;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 datatype POSITION Speeds" wait 1
test-func1: func [
data [object! block! string! number! object! block! string! number! object! block! string! number! object! block! string! number! object! block! string! number! object! block! string! number! object! block! string! number! object! block! string! number! word!]
] [
]
test-func2: func [
data [word!]
] [
]
Print ["S1: Testing Datatype after about 20 others: " s1: dt [loop 10000000 [test-func1 'aword]]]
wait 1
Print ["S2: Testing Datatype at first position: " s2: dt [loop 10000000 [test-func2 'aword]]]
if platform? = 'rebol [
s1: to-decimal s1
s2: to-decimal s2
]
Print ["Difference: s1/s2 " 100 - ((s1 / s2) * 100)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment