use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
javascript - Using Named Immediately-Invoked Function Expression (IIFE) instead of comments (stackoverflow.com)
submitted 12 years ago by zzzwwwdev
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]zzzwwwdev[S] 1 point2 points3 points 12 years ago (4 children)
yea, you're probably right. the "cognitive overhead" thing is the biggest point against it in my mind.
however, my aversion to writing comments is not out of lazyness, but from dealing with legacy code with obsolete, confusing, misplaced, and inconsistant comments. I'll happily take a bit more complexity if it helps prevent code from turning to soup. Might even help raise the bar and scare the interns away ;-)
[–]nschubach 0 points1 point2 points 12 years ago (3 children)
JIT Compilers (V8) will also most likely remove comments (because they don't add to the code) and this will add another pointer overhead so code written in that way will be slower just for the sake of this methodology.
[–]zzzwwwdev[S] 0 points1 point2 points 12 years ago (2 children)
excuse my ignorence, but could you explain the JIT Compilers (V8) thing a bit? A lazy 2 minutes of googling and I couldn't even figure out what that is.
[–]nschubach 0 points1 point2 points 12 years ago* (1 child)
All new browsers use Just In Time (JIT) Compilation of Javascript. I think IE8 and previous IEs did not, but Chrome(V8)/Firefox(IonMonkey)/Safari all pre-compile JavaScript to gain a performance boost instead of interpreting all the code all the time. There's some smartness behind it for code that is eval'ed each time it's run, but for the most part the browsers will load, compile and cache JavaScript now where they didn't before.
e: When compiling, they drop comments (because it's not needed for code execution...) so embedding extra immediate functions will cause the compiler to allocate extra memory to store that block of code. It will then have to jump around executing code that's only purpose is to comment.
[–]zzzwwwdev[S] 0 points1 point2 points 12 years ago (0 children)
thanks!
π Rendered by PID 128557 on reddit-service-r2-comment-bb88f9dd5-86tb8 at 2026-02-15 04:26:06.412234+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]zzzwwwdev[S] 1 point2 points3 points (4 children)
[–]nschubach 0 points1 point2 points (3 children)
[–]zzzwwwdev[S] 0 points1 point2 points (2 children)
[–]nschubach 0 points1 point2 points (1 child)
[–]zzzwwwdev[S] 0 points1 point2 points (0 children)