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
-
-
There's a dance here, and an unusual one at that. Rather than inference, is there any mileage for, say, declarative prioritization? I ask because whenever an engine infers it makes the implementation details canonical & generates received "wisdom". Like translateZ.
-
…and like optimize-js, which is mentioned in the blog post.
We’re in agreement. Developers shouldn’t optimize for any particular implementation heuristic (which might change at any point in time!).
End of conversation
New conversation -
-
-
I can't see any case why !function would be used if not in a iife or in a syntax error, while (function can be used for composition, event handling etc
-
Sure. I just wanted to point out that we don’t just look for a single pattern (as the article explains). I’ll try to clarify this in the article.
- 1 more reply
New conversation -
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.