Skip to content
Advertisement

Tag: performance

Is ternary operator, if-else or logical OR faster in javascript?

Which method is faster or more responsive in javascript, if-else, the ternary operator or logical OR? Which is advisable to use, for what reasons? Answer The speed difference will be negligible – use whichever you find to be more readable. In other words I highly doubt that a bottleneck in your code will be due to using the wrong conditional

fastest MD5 Implementation in JavaScript

There are many MD5 JavaScript implementations out there. Does anybody know which one is the most advanced, most bugfixed and fastest? I need it for this tool. Answer I’ve heard Joseph’s Myers implementation is quite fast. Additionally, he has a lengthy article on Javascript optimization describing what he learned while writing his implementation. It’s a good read for anyone interested

Does removing comments improve code performance? JavaScript

Does removing comments from JavaScript code improve performance? I realize that this is not great programing practice as comments form an intrinsic part of development. I am just interested to know if they do in fact add some overhead during compilation. Answer Whether your compiling or interpreting your JavaScript, the compiler/interpreter needs to look at the line, decide it’s a

How to quickly clear a JavaScript Object?

With a JavaScript Array, I can reset it to an empty state with a single assignment: This makes the Array “appear” empty and ready to reuse, and as far as I understand is a single “operation” – that is, constant time. Is there a similar way to clear a JS Object? I know I can iterate its fields deleting them:

Advertisement