Does omitting semicolons affect performance in JavaScript?
Tiny differences in code syntax usually have very little effect on the performance of the code. the process of interpreting a string of code is very efficient and takes a tiny fraction of the time taken by actually running the code.
An inefficient algorithm or an extra network call, such as pulling in multiple .js files instead of a single one have far greater impact.
Omitting semicolons in JS is big debate, but we should always keep semicolon. If you talk about performance, then there will be very little benefit while keeping semicolon.
But the things not end up here only. Other than performance there is one big thing which needs to be take care.
Doug Crockford explains the need of semicolons very well in this presentation:
The JS Interpreter finds an error, adds a semicolon, and runs the whole thing again. But not every time he puts the semicolon on the right place and hilarious bugs are the consequence. You should always make semicolons and run your js through testing tools like JSLint.
Other than this semicolons give the code more structure and make it cleaner - additionally, their presence allows some developers to obfuscate their code.
Hope it will help you.
A javascript file with spaces, semi-colons and comments is heavier. That's the main impact.
But you're a coder and you have to maintain the code, so this very slight impact is much less important than the adverse one on readability. And omitting the semicolons means you know when you can omit them. But the rules aren't so simple and learning them isn't worth your time.
Leave the semi-colons where they are, you'll avoid bugs.
And use a minifier to build a more concise code for the browser if you want to have the lightest possible code. It's its duty, not yours.