performance - javascript functions and arguments object, is there a cost involved -


This is a common place to view code similar to Web and Framework:

  Var args = Array.prototype.slice.call (logic);   

By doing this, you can convert a object to an actual array (as much as real as the real arrays ) And it allows me to arrange your array prototype, which can be applied to array methods, etc.

I remember that anywhere by reaching the logic object can be slower than the one directly, with the clear choice of array clones or nominated arguments, is there any truth for this and what Under the circumstance / browser does it impose a performance penalties? Any article on the topic you know?

Update Find something interesting that I had read before, invalidating ... people who have hoped for this question get some more answers than those who wrote it.

Below that section it says:

display myths and truth

The logic object is always only two Exceptions are created with where it has been declared as the name of the function or the name of its formal criteria.

There is a conflict with this, which says:

However, it is not a good idea to use logic for the reasons:

  • Display
  • Security

    The logic object function is not automatically created every time, the JavaScript engine will only make it on-demand , If it is used and it is not free in terms of creation execution. The difference between using logic vs versus on a browser basis can be anywhere from 1.5 times to 4x,

    Obviously, both can not be correct, so which is the one ?

    ECMA Die Hard-Hard Dmitry Sosnikov said:

    Which javascript engine ???? is meant? Where did you find this exact information? Although it can be true in some implementations (yes, it is good optimization because all necessary information of the reference is available for parsing the code, so there is no need to create any argument object on parsing), but like If you know the ECMA-262-3 details, that argument is made every time on entering the execution context.

    some q & amp; Using the d test predefined arguments seems fast, but it is not always possible to do this. If the access to the function is already unknown (therefore, if a function should get a variable amount of arguments or should), then I think calling Array.prototype.slice It would be an effective method because in that case the lowest is the use of the arguments object.

  • Comments