append is slower than appendChild |
|||
Issue descriptionAs per the benchmark, https://jsperf.com/document-fragment-vs-appendchild/1, append is slower than appendChild. - appendChild: 5,642 Ops/sec - append: 4,845 Ops/sec See also: - https://dom.spec.whatwg.org/#dom-parentnode-append - https://github.com/whatwg/dom/issues/433 for Standard. Note that Blink has an optimization in a case of nodes.size == 1 so that DocumentFragment is not created. https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/Node.cpp?q=Node.cpp&sq=package:chromium&l=536 However, the benchmark does't use multiple arguments, so it might not matter.
,
Feb 21 2018
Binding folks, if you have any ideas to avoid allocating HeapVector for a single arg, let us know that.
,
Feb 21 2018
It probably wouldn't be too hard to map to a HeapVector with inline capacity (whatever we think is reasonable; maybe 4 or 8?). Depending on what the call sites do, it might also be useful to make efficient move-constructing from a vector of different inline capacity possible. Not clear to me whether append and other varargs IDL methods have substantial usage (after all, callers can already use appendChild).
,
Feb 22 2018
> Not clear to me whether append and other varargs IDL methods have substantial usage (after all, callers can already use appendChild). I'm not sure about each usage, however, this is a general issue of varagrs IDL methods, as you said. Maybe we might want to change the title of this issue, or file a new issue so that people know that this might apply other varargs IDL methods widely.
,
Feb 22 2018
I think the difference can be detected only by micro benchmarks. It is unlikely that real web sites can notice the difference. This is P3 issue for us, I think.
,
Jul 4
|
|||
►
Sign in to add a comment |
|||
Comment 1 by hayato@chromium.org
, Feb 21 2018Status: Assigned (was: Available)