I did a little bit of performance sampling and noticed a fair bit of boot time was spent in a function called INHERIT-META. It's was called often, and it was slow.
Carl & BrianH & co were big fans of taking bottleneck functions and making them natives. I've tried to avoid that for "weird" functions, but I will make an exception here.
I'm keeping a copy of the original code, which isn't even complete...despite being slow. :-/
inherit-meta: func* [
return: "Same as derived (assists in efficient chaining)"
[action!]
derived [action!]
original "Passed as WORD! to use GET to avoid tainting cached label"
[word!]
/augment "Additional spec information to scan"
[block!]
][
original: get original ; GET so `specialize :foo [...]` keeps label foo
if let m1: meta-of :original [
set-meta :derived let m2: copy :m1 ; shallow copy
if select m1 'parameter-notes [ ; shallow copy, but make frame match
m2/parameter-notes: make frame! :derived
for-each [key value] m1/parameter-notes [
if in m2/parameter-notes key [
m2/parameter-notes/(key): get* 'value ; !!! BAD-WORD!s
]
]
]
if select m1 'parameter-types [ ; shallow copy, but make frame match
m2/parameter-types: make frame! :derived
for-each [key value] m1/parameter-types [
if in m2/parameter-types key [
m2/parameter-types/(key): get* 'value ; !!! BAD-WORD!s
]
]
]
]
return get 'derived ; no :derived name cache
]