What is the difference between using call and apply to invoke a function?  var func = function() {   alert('hello!'); };   func.apply(); vs func.call();  Are there performance differences between the two aforementioned methods? When is it b...
I'm writing a Chrome extension that involves doing a lot of the following job: sanitizing strings that might contain HTML tags, by converting <, > and & to &lt;, &gt; and &amp;, respectively.  (In other words, the same as...
What kinds of activities will trigger reflow of web page with DOM?  It seems there are different points of view. According to http://www.nczonline.net/blog/2009/02/03/speed-up-your-javascript-part-4/,  it happens   When you add or remove a DOM node...
How do parseInt() and Number() behave differently when converting strings to numbers?...
From the MDN docs for the standard setPrototypeOf function  as well as the non-standard  __proto__ property:     Mutating the [[Prototype]] of an object, no matter how this is accomplished, is strongly discouraged, because it is very slow and unavo...
I ran this code and got the below result. I curious to know why [] is faster?  console.time('using[]') for(var i=0; i<200000; i++){var arr = []}; console.timeEnd('using[]')  console.time('using new') for(var i=0; i<200...
Is there a good profiler for javascript? I know that firebug has some support for profiling code. But I want to determine stats on a longer scale.  Imagine you are building a lot of javascript code and you want to determine what are actually the bot...
I have a model with possibly thousands of objects. I was wondering what would be the most efficient way of storing them and retrieving a single object once I have it's id. The id's are long numbers.  So these are the 2 options I was thinkin...
What's the fastest way to count the number of keys/properties of an object?  It it possible to do this without iterating over the object?  i.e. without doing  var count = 0; for (k in myobj) if (myobj.hasOwnProperty(k)) count++;   (Firefox did...
I've recently read the Yahoo manifesto Best Practices for Speeding Up Your Web Site. They recommend to put the JavaScript inclusion at the bottom of the HTML code when we can.  But where exactly and when?  Should we put it before closing </h...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.