DEV Community

Discussion on: Avoid slow Javascript code

Collapse
 
valeriavg profile image
Valeria

Optimization needs to be measurable. You wont notice memory leaks by looking at the code. Instead, you should use profiler, lighthouse and other utilities at hand to find and mitigate performance problems. Unused variables are bad for readability but they hardly have any effect on the performance

Collapse
 
cleveroscar profile image
Oscar Ortiz

You’re right! I appreciate the feedback! I’ll make sure to add some of your info into the details.

I appreciate the feed back!

Collapse
 
jamesthomson profile image
James Thomson

Exactly. Unless the unused variables are being constantly re-declared there should be no performance implications. The GC will clear it up from memory pretty quickly.... not that I'm condoning leaving unused variables in your codebase, but I think this is a moot point in terms of performance.