creating new object for each closure creation may influence on overall perfomance, why not lift RTTI object out of closure context and create it once, since types wont be changing in runtime.
function a() {
return function b(param: number) {}
}
this code translates to something like this
function a() {
return R.fn(function b(param) {}, {…RTTI data…})
}
its clear that each a call it creates new object with RTTI data
and it will be better to store it globally outside
const b_rtti_data = {}
function a() {
return R.fn(function b(param) {}, b_rtti_data)
}
creating new object for each closure creation may influence on overall perfomance, why not lift RTTI object out of closure context and create it once, since types wont be changing in runtime.
this code translates to something like this
its clear that each a call it creates new object with RTTI data
and it will be better to store it globally outside