Terminology:
IIFE: (function() { code })()
PIFE: (function() { code })
Since IIFE detection would be too slow, JavaScript engines detect PIFEs to decide whether to eagerly parse + compile functions that are needed, boosting startup times.
https://v8.dev/blog/preparser
-
-
Ah, okay. The example was (no reference saved, so the function couldn't be called), so I wondered if it was a joke.

-
The article explains it in more detail; it’s all about looking at it from the perspective of a JS parser. You just don’t know whether the function expression is immediately invoked until you parse all the way to the end, which is costly. We need a simpler heuristic, thus: PIFEs.
End of conversation
New conversation -
-
-
Parenthesis-Included Function Expression
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.