console.log Will Cost You Browser Ops

Writing log statements in your javascript code is a habitual practice for web developers. But if you do not comment them out you might be giving up performance for nothing. This is the single most simple tweak you can do to your code to speed up javascript execution. Remember to comment out those log statements before you push code to production. This is a bigger problem for mobile browsers because every browser operation is important with that limited processing power your app gets.

To see how leaving console.log statements in your code can affect performance. Look at this jsperf test I wrote.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s