Skip to content

Adding Time Complexity Annotation Where Applicable #520

Answered by ghost
torressam333 asked this question in Content
Discussion options

You must be logged in to vote

The ECMAScript specification does give algorithms that engines should follow, and we can analyse their Big-O notation complexities, but engines are only required to act "as if" following such algorithms, therefore are open to implementations that, for example, completely elude memory usage for a particular algorithm, or possibly (although unlikely) perform more internal work therefore this doesn't seem possible to accurately describe what performance characteristics can be expected.

Take Array#unshift: this could be amortized to an O(log(n)) operation in engine implementations that keep a base pointer in their array data structure and allocate memory on both ends when deemed necessary, ye…

Replies: 0 comments 7 replies

Comment options

You must be logged in to vote
5 replies
@Josh-Cena
Comment options

@torressam333
Comment options

@Josh-Cena
Comment options

@ghost
Comment options

@Josh-Cena
Comment options

Answer selected by torressam333
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants