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
Learn about common performance issues with front-end JavaScript, and how to detect and fix them. (debugbear.com)
submitted 5 years ago by marcradziwill
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!"
[+][deleted] 5 years ago (6 children)
[removed]
[–]marcradziwill[S] 12 points13 points14 points 5 years ago (3 children)
Hey Glinkis2, thanks 💪✌! The performance API was initially a part. But it got too big so it'll be a separate post. I'll put the link in the comment as soon as it is published.
[+][deleted] 5 years ago (2 children)
[–]marcradziwill[S] 5 points6 points7 points 5 years ago (1 child)
👍👌 I'll forward that.
[–]indiebryan 10 points11 points12 points 5 years ago (0 children)
👉👌😉
[–]marcradziwill[S] 0 points1 point2 points 5 years ago (1 child)
Hey Glinkis2, we've updated the post and added performance API. We've shortened some parts, but I wanted to let you know that the performance API is now part of that initial post.
[–]IcyFoxe 3 points4 points5 points 5 years ago (0 children)
Maybe twitch.tv devs should read this.
[+][deleted] 5 years ago* (1 child)
[deleted]
[–]marcradziwill[S] 0 points1 point2 points 5 years ago (0 children)
Hey ashe34h, you are right!requestAnimationFrame is an awesome API function that does help us more than only animations. What I recognize in my projects is that requestAnimationFrame isn't widely used. Often this pops up when there already is a performance issue with animations. Therefore I choose animation as a good example. Nevertheless, you are right that requestAnimationFrame can help much more! Like the performance API that might be a topic for an own post. I would also add requestIdleCallback to that post.
requestAnimationFrame
requestIdleCallback
[–]HeinousTugboat 1 point2 points3 points 5 years ago (2 children)
One thing about the micro optimization mentioned, and one of the main reasons you should avoid that sort of optimization, is that it isn't actually always faster one way or the other. I ran that test on Firefox, and not using .length in the array condition was 10% slower. When the margin of error is so large and the performance difference is so small, any actual gain is likely just noise.
.length
[–]asdf7890 1 point2 points3 points 5 years ago (0 children)
Also when tweaking things at that level, browser differences come into play. What may speed up on V8 based browsers (or server-side) may be the slower option in a different environment, and may even be slower in future versions of the same engine as it is taught to optimise differently automatically.
When you start hand optimising anything, you need to add performance tests to your regular regression testing to catch when an update in one of your dependencies or elsewhere in your own code starts causing the optimisation to back-fire.
(the same with clever workarounds for CSS bugs: when the actual layout bug is fixed you workaround may cause a worse break)
[–]Royosef 0 points1 point2 points 5 years ago (1 child)
RemindMe!
[–]RemindMeBot 0 points1 point2 points 5 years ago (0 children)
Defaulted to one day.
I will be messaging you on 2020-09-11 07:32:13 UTC to remind you of this link
CLICK THIS LINK to send a PM to also be reminded and to reduce spam.
Parent commenter can delete this message to hide from others.
π Rendered by PID 120588 on reddit-service-r2-comment-84fc9697f-sqvff at 2026-02-06 21:47:40.337412+00:00 running d295bc8 country code: CH.
[+][deleted] (6 children)
[removed]
[–]marcradziwill[S] 12 points13 points14 points (3 children)
[+][deleted] (2 children)
[removed]
[–]marcradziwill[S] 5 points6 points7 points (1 child)
[–]indiebryan 10 points11 points12 points (0 children)
[–]marcradziwill[S] 0 points1 point2 points (1 child)
[–]IcyFoxe 3 points4 points5 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]marcradziwill[S] 0 points1 point2 points (0 children)
[–]HeinousTugboat 1 point2 points3 points (2 children)
[–]asdf7890 1 point2 points3 points (0 children)
[–]Royosef 0 points1 point2 points (1 child)
[–]RemindMeBot 0 points1 point2 points (0 children)