JsInliner.containsNestedFunctions traverses a function's entire body, and is called once per candidate call site through
isInlinable → isVolatile → affectedBySideEffects ,on every inliner pass.
The predicate is a pure function of the body, so the work is redundant. On two large applications (122 and 231 split points), JFR sampling with full stack depth attributes ~79% of all JsInliner time to this single predicate; JsInliner itself is 28.7% of the permutation's CPU and 36–48% of total compile time.
Memoizing it takes JsInliner from 57.9s to 10.5s and from 328.5s to 22.8s on those two applications, with byte-identical output.
JsInliner.containsNestedFunctionstraverses a function's entire body, and is called once per candidate call site throughisInlinable → isVolatile → affectedBySideEffects,on every inliner pass.The predicate is a pure function of the body, so the work is redundant. On two large applications (122 and 231 split points), JFR sampling with full stack depth attributes ~79% of all JsInliner time to this single predicate; JsInliner itself is 28.7% of the permutation's CPU and 36–48% of total compile time.
Memoizing it takes JsInliner from 57.9s to 10.5s and from 328.5s to 22.8s on those two applications, with byte-identical output.