Open NTillmann opened 7 years ago
Doing this will increase the code size. Maybe we should leave the inline optimization to the JS compiler?
Indeed, we should measure first what relevant JS compilers actually inline.
I looked into it. For what matters most for Facebook, nothing gets inlined here. And calls to simple functions like $_0...$_2 look rather expensive. Prepack should inline $_0.
And when still parameters are involved, consider a scheme like the following best hidden class efficiency.
function $_0(__0, __1) {
let __res = {
x: undefined,
y: undefined
};
__res.x = __0;
__res.y = __1;
return __res;
}
The
factorifyObjects
feature in Prepack reduces code size by creating factory functions for common object creation patterns. For example,prepacks to
While correct, the two levels of factory functions seems a bit excessive. We should consider simply inlining
$_0
. This would save a good thousand function calls in a medium FB internal JavaScript program.