I know that each browser will implement it differently, but are there any references or standards that specify this?
The simple implementation appears in the number of children of O (n)
to node
: Edit: I have some Here are the results.
Firefox 3.6.10 on Linux
1000 elements in 1000 elements 131.44 ms (average above 101 tests, 291.31 ms inc. Appendibil) Enter Dome: Truly contained 1000 elements include 235.91 ms (more than 11 tests, 1311.36 ms inc. Append child) in 10000 elements The truth is included in the DOM, while the true 1000 elements in Dome 2349.00 ms (average in more than 2 tests, 14150.50 ms inked child): In truth, 1000 elements in 1000 elements include 13.13 ms (more than 101 tests, 267.00 ms inc. Appendibil) 1000 elements have been inserted in the DOM, while 1000 1000 elements have been inserted in the DOM, 10000 elements in 67.45 ms (average above 11 tests, 1517.09 ms inc. Appendibil) while Dome: Chrome 7 on Linux: false false entry in 1997 M 1000 elements have been added to 100,000 elements in 617.00 ms (more than 2 trials, 15214.50 ms inc. Append child):
1000 elements in 1000 elements 0.65 ms (more than 101 tests average, 30.34 ms inc. Append child) while in the domes: 10005 in 1005 elements were inserted in 1.55 ms (more than 1000 tests, 175.09 ms inc. Append child), while true 1000 Elements 1000.00 to 12.00 ms (more than 1000 tests 2, 2255.00 ms inc. Appendet Child) While in DOM: 10009 in 1,000 elements enter the correct 1000 entries in 0.49 ms (more than 101 trials, 41.13 ms inc. Appendibil): 996 elements in HTTPS in 1996, 301.18 ms in append child) In Dome: In the wrong 1000 entity 1200 ms (more than 2 trials, 2565.50 ms in append child) in 10000 elements while in the dome: false
I created dome node, call it N
populated with elements, and then insertBefore (nichil, random p Initial)
M
is called the bar.
In DOM: False
This means that the parent node was not a decoder in the document tree, so the browser should not reshape the layout (I hope?) < / P>
The results show that the insert is O (n)
a.insertBefore (b)
If the nodes are stored in a linked list, then this process to search the node before b
Equally simple, that takes time (O) because the following Are not the indicators of the field, only the next node indicator we then change the next indicator of the node before b
to a
.
So, you are right, the process takes you to O (N) with the best of a linked list, unless the list is doubled.
Comments
Post a Comment