Created
March 31, 2018 02:50
-
-
Save hiiamboris/6935c96e6d921c11435930777ed9984e to your computer and use it in GitHub Desktop.
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 [] | |
clock: func [code /local t1 t2] [ | |
t1: now/precise/time | |
loop 100 code | |
t2: now/precise/time | |
print [(t2 - t1) mold/flat code] | |
] | |
m1: make hash! [] | |
m2: make hash! [] | |
m3: make hash! [] | |
m4: make hash! [] | |
m5: make hash! [] | |
m6: make hash! [] | |
repeat i 10000 [ | |
put m1 (rejoin ["s" i]) i | |
put m2 (to-word rejoin ["wordwordwordwordwordword" i]) i | |
put m3 i i | |
put m4 rejoin ["" i " string string string string " i] i | |
put m5 rejoin ["somestring somestring somestring " i] i | |
] | |
subset: copy [] | |
loop 100 [append subset random 10000] | |
;probe m1 | |
;probe m2 | |
;probe m4 | |
chosen1: copy [] foreach n subset [append chosen1 rejoin ["s" n]] | |
chosen2: copy [] foreach n subset [append chosen2 to-word rejoin ["wordwordwordwordwordword" n]] | |
chosen3: copy [] foreach n subset [append chosen3 n] | |
chosen4: copy [] foreach n subset [append chosen4 rejoin ["" n " string string string string " n]] | |
chosen5: copy [] foreach n subset [append chosen5 rejoin ["somestring somestring somestring " n]] | |
;chosen5bulk: copy [] foreach n subset [append/dup chosen5bulk rejoin ["somestring " n] 2] | |
probe reduce [ | |
20000 = length? m1 | |
20000 = length? m2 | |
20000 = length? m3 | |
20000 = length? m4 | |
20000 = length? m5 | |
100 = length? chosen1 | |
100 = length? chosen2 | |
100 = length? chosen3 | |
100 = length? chosen4 | |
100 = length? chosen5 | |
] | |
clock [ foreach s chosen1 [find m1 s] ] | |
clock [ foreach w chosen2 [select m2 w] ] | |
clock [ foreach n chosen3 [select m3 n] ] | |
clock [ foreach s chosen4 [select m4 s] ] | |
clock [ foreach s chosen5 [select m5 s] ] | |
clock [ foreach n chosen3 [put m3 n n] ] | |
clock [ foreach s chosen5 [put m5 s s] ] | |
clock [ foreach s chosen5 [put m6 s s] ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment