continue this thread
continue this thread
continue this thread
::after
(3 replies)
{"ScriptPreparationCode":"const template = document.getElementById(\u0027ELEMENTS\u0027).content;\r\nvar RESOURCES = {\r\n pulsar: \t \ttemplate.children[0].cloneNode(true),\r\n pulsarStr: \ttemplate.children[0].outerHTML,\r\n expand: \t\ttemplate.children[1].cloneNode(true),\r\n expandStr: \ttemplate.children[1].outerHTML,\r\n a: \t\t\ttemplate.children[2].cloneNode(true),\r\n aStr: \t\ttemplate.children[2].outerHTML, \r\n deepthread: \ttemplate.children[3].cloneNode(true), \r\n container: \tdocument.getElementById(\u0027container\u0027),\r\n get deepthreads() {\r\n return Array.from(this.container.childNodes);\r\n },\r\n deleteChildren(root) {\r\n while (root.firstChild) { root.lastChild.remove(); }\r\n return root;\r\n }, \r\n replaceChildren_append(root, ...replacements) {\r\n while (root.firstChild) { root.lastChild.remove(); }\r\n root.append(...replacements);\r\n return root;\r\n }, \r\n replaceChildren_appendChild(root, ...replacements) {\r\n while (root.firstChild) { root.lastChild.remove(); }\r\n\tfor(let len=replacements.length, i=0; i\u003Clen; \u002B\u002Bi) { root.appendChild(replacements[i]); }\r\n return root;\r\n }, \r\n};\r\n\r\nfor(let { container, deepthread }=RESOURCES, i = 0; i \u003C 100; i\u002B\u002B) {\r\n container.appendChild(deepthread.cloneNode(true));\r\n}\r\n\r\n","TestCases":[{"Name":"innerHTML","Code":"// caching vars doubles bench speed. The length of the scope chain to access values from preparation is excessive\r\nconst { container, deepthreads, pulsarStr, expandStr } = RESOURCES; \r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n deepthreads[i].innerHTML = pulsarStr; \r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n deepthreads[i].innerHTML = expandStr; \r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n deepthreads[i].innerHTML = \u0027\u0027; \r\n}\r\ncontainer.innerHTML = \u0027\u0027;\r\n","IsDeferred":false},{"Name":"removechild \u0026 appendChild(cloneNode())","Code":"// caching vars doubles bench speed. The length of the scope chain to access values from preparation is excessive\r\nconst { container, deepthreads, pulsar, expand } = RESOURCES;\r\nfor(let child, dt, len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { (dt = deepthreads[i]);\r\n while ((child=dt.lastChild)!==null) { child.remove(); }\r\n dt.appendChild(pulsar.cloneNode(true));\r\n}\r\nfor(let child, dt, len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { (dt = deepthreads[i]);\r\n while ((child=dt.lastChild)!==null) { child.remove(); }\r\n dt.appendChild(expand.cloneNode(true));\r\n}\r\nfor(let child, dt, len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { (dt = deepthreads[i]);\r\n while ((child=dt.lastChild)!==null) { child.remove(); }\r\n}\r\nfor(let child; (child=container.lastChild)!==null; ) { \r\n child.remove() \r\n}\r\n","IsDeferred":false},{"Name":"replaceChildren","Code":"// caching vars doubles bench speed. The length of the scope chain to access values from preparation is excessive\r\nconst { container, deepthreads, pulsar, expand } = RESOURCES;\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n deepthreads[i].replaceChildren(pulsar.cloneNode(true));\r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n deepthreads[i].replaceChildren(expand.cloneNode(true));\r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n deepthreads[i].replaceChildren();\r\n}\r\ncontainer.replaceChildren();","IsDeferred":false},{"Name":"Custom deleteChildren","Code":"// caching vars doubles bench speed. The length of the scope chain to access values from preparation is excessive\r\nconst { container, deepthreads, pulsar, expand, deleteChildren } = RESOURCES;\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n deleteChildren(deepthreads[i]).appendChild(pulsar.cloneNode(true)); \t\r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n deleteChildren(deepthreads[i]).appendChild(expand.cloneNode(true)); \r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n deleteChildren(deepthreads[i]); \r\n}\r\ndeleteChildren(container); \r\n","IsDeferred":false},{"Name":"Custom replaceChildren via append","Code":"// caching vars doubles bench speed. The length of the scope chain to access values from preparation is excessive\r\nconst { container, deepthreads, pulsar, expand, replaceChildren_append } = RESOURCES;\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n replaceChildren_append(deepthreads[i], pulsar.cloneNode(true)); \r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n replaceChildren_append(deepthreads[i], expand.cloneNode(true)); \r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n replaceChildren_append(deepthreads[i]); \r\n}\r\nreplaceChildren_append(container); \r\n","IsDeferred":false},{"Name":"Custom replaceChildren via appendChild","Code":"// caching vars doubles bench speed. The length of the scope chain to access values from preparation is excessive\r\nconst { container, deepthreads, pulsar, expand, replaceChildren_appendChild } = RESOURCES;\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n replaceChildren_appendChild(deepthreads[i], pulsar.cloneNode(true)); \r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n replaceChildren_appendChild(deepthreads[i], expand.cloneNode(true)); \r\n}\r\nfor(let len=deepthreads.length, i=0; i\u003Clen; \u002B\u002Bi) { \r\n replaceChildren_appendChild(deepthreads[i]); \r\n}\r\nreplaceChildren_appendChild(container); ","IsDeferred":false}]}