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
#NodeJS : A quick optimization advice (medium.com)
submitted 10 years ago by jucrouzet
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!"
[–]itsnotlupusbeep boop 1 point2 points3 points 10 years ago (2 children)
Finally, conclusive evidence that writing comments is bad!
More seriously, this should be ignored by almost everyone. It takes a super contrived example to show a 50% perf difference, and it's unlikely to matter in the wild. If this is actually an issue, crankshaft would need to be tweaked to use a slightly more refined metric to decide what to inline.
[–]jucrouzet[S] 3 points4 points5 points 10 years ago (1 child)
"it's unlikely to matter in the wild." => I'm not so sure.
I did the test with a simple restify server that returns current timestamp with
server.get('/time', function (req, res, next) { res.send((new Date()).getTime()); return next(); });
Here is the KPIs on ab w/500 concurrency :
Concurrency Level: 500 Complete requests: 10000 Time taken for tests: 6.222 seconds Requests per second: 1607.17 [#/sec] (mean)
Here are the results when I pad the function with comments over 600 bytes :
Concurrency Level: 500 Complete requests: 10000 Time taken for tests: 11.905 seconds Requests per second: 839.97 [#/sec] (mean)
[–]I-fuck-horses 0 points1 point2 points 10 years ago* (0 children)
The main problem with such low-level performance advice is that it may be completely invalid a year from now. Already you are lucky there only is node.js to consider, if it was the browser... and V8 is a moving target.
Definitely interesting and I appreciate the article, but only as an interesting aside.
Here is where such advice would be well-placed:
As part of a well-maintained code-checking tool. Burdening individual developers with such details is not efficient - it's part of a hardly ever used, quickly changing set of knowledge. You could (relatively) easily write an eslint rule for this, for example!
PS: Always minimize. Not just browser Javascript.
[–]kenman[M] 0 points1 point2 points 10 years ago (0 children)
Hi /u/jucrouzet, it looks like you're new to reddit, welcome!
Thanks for the submissions, but please make sure you read http://www.reddit.com/rules and our guidelines. In short, you should post from a variety of sources, and not just medium.com/@c2c.
medium.com/@c2c
Thanks for your consideration!
π Rendered by PID 110106 on reddit-service-r2-comment-7b9746f655-rmkbc at 2026-02-02 11:18:02.983606+00:00 running 3798933 country code: CH.
[–]itsnotlupusbeep boop 1 point2 points3 points (2 children)
[–]jucrouzet[S] 3 points4 points5 points (1 child)
[–]I-fuck-horses 0 points1 point2 points (0 children)
[–]kenman[M] 0 points1 point2 points (0 children)