Closed GoogleCodeExporter closed 9 years ago
Whether a function gets inlined depends on whether inlining it will save space:
"f(a)" is smaller than "a != void 0", and will generally only be inlined if the
definition can be removed and there are a sufficiently small number of uses
that the function definition doesn't out way the size of the calls.
If you would like something changed here you will have to provide some
additional justification.
Original comment by concavel...@gmail.com
on 13 Mar 2014 at 12:16
Well, but "f(a)" also smaller than "a != null", but goog.isDefAndNotNull does
inline.
Am I missed something?
I am very using goog.isDef() and want to prevent performance penalty (due to
function call) and I hoped compiler does it.
Original comment by alexey.l...@gmail.com
on 13 Mar 2014 at 4:58
I don't know much about the inlining heuristics of Closure compiler, but you
shouldn't worry about the performance penalty. Simple function calls like that
are definitely inlined by the JavaScript VMs.
Original comment by dim...@google.com
on 13 Mar 2014 at 7:37
May be, in theory. But jsperf tests show performance degradation:
http://jsperf.com/function-calls-vs-spagetti
It does matter for our app, 'cos it very large and full of calls of small
methods (especially after adopting code to closure compiler).
Original comment by alexey.l...@gmail.com
on 13 Mar 2014 at 8:02
Original issue reported on code.google.com by
alexey.l...@gmail.com
on 12 Mar 2014 at 11:39