I know that the Javascript standard does not specify required time plexities for methods like array unshift
but is there a reference for time plexities in a specific Javascript engine like V8?
I know that the Javascript standard does not specify required time plexities for methods like array unshift
but is there a reference for time plexities in a specific Javascript engine like V8?
2 Answers
Reset to default 10is there a reference for time plexities in a specific Javascript engine like V8?
No.
The ECMA specification does not specify a bounding plexity, as you already might know, and nor does that engine. Every JavaScript engine is free to implement its own functionality, as long as it is patible with the Standard.
V8, for example, does not provide Time Complexities for its methods.
You could of course look at the source code, construct the algorithm used under the hood in our mind, understand it, analyse it and then e up with a bound for its Time Complexity.
Check THis.
Mutator Methods.
- push() - 0(1)
- pop() - 0(1)
- shift() - 0(n)
- unshift() - 0(n)
- splice() - 0(n)
- sort() - 0(n log(n))
Accessor methods
- concat() - 0(n)
- slice() - 0(n)
- indexOf() - 0(n)
Iteration methods
- forEach() - 0(n)
- map() - 0(n)
- filter() - 0(n)
- reduce() - 0(n)