Setting inline style spends 10% of time in LookupIterator due to missing attribute handlers |
||||||||||||||
Issue descriptionThis was the result of implementing some strange read through behavior in the spec: http://heycam.github.io/webidl/#OverrideBuiltins but it produces some crazy results, ex. Object.prototype.color = "wtf"; makes *every* style object in the entire document report "wtf" for the color property. ex. document.createElement("div").style.color == "wtf" This perf regression was reported by the bots but marked as WontFix which is not right: https://bugs.chromium.org/p/chromium/issues/detail?id=478105 our behavior here doesn't match the CSSOM spec either, the spec says that we're supposed to have getters and setters on the CSSStyleDeclaration object not do this crazy read through behavior (which no other browser is doing). See https://drafts.csswg.org/cssom/#ref-for-cssstyledeclaration-5
,
Jul 15 2016
A profile of the JS execution time in CSS/CSSPropertyUpdateValue.html benchmark reports:
Running Time Self (ms) Symbol Name
10986.0ms 11.1% 577.0 v8::internal::LookupIterator::PropertyOrElement(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, bool*, v8::internal::LookupIterator::Configuration)
which means that DOM code that's setting inline styles for animations took a 10% perf hit by this change. We need to revert this change, or switch to following the spec and have real getter/setters or something. Right now Chrome matches neither Firefox, Safari or Edge.
This read through behavior in general is very strange, it seems pretty broken that setting a value on Object.prototype would break all of the instance interceptors.
ex.
Object.prototype.test = "wtf";
localStorage.setItem("test", "should be test")
localStorage.test == "wtf";
but
Object.getOwnPropertyDescriptor(localStorage, "test").value == "should be test"
so JS is telling you the instance has this property, but setter/getting it always goes up the prototype chain. Technically Proxies are capable of this behavior, but it's super confusing, and results in a 10% performance slowdown on *everything* that has an interceptor.
,
Jul 15 2016
Hmm so I can see why localStorage wants this:
localStorage.setItem("setItem", "10")
localStorage.setItem == Storage.prototype.setItem;
though the spec does result in some confusing behavior:
// Actually sets a data property, since hasOwnProperty is on the prototype chain.
localStorage.hasOwnProperty = "test";
localStorage.getItem("hasOwnProperty") == undefined
In either case CSSStyleDeclaration isn't supposed to use an interceptor and do named lookup like localStorage at all, so Chrome isn't following any spec with it's current behavior.
We should probably switch to having actual getter/setters so we at least follow the spec, and also so we don't take the 10% perf hit.
,
Jul 19 2016
timloh@, could you triage this issue? I think this is an issue of core/css/, at least it's CSS team who made a decision to implement CSS attributes as named properties.
,
Jul 27 2016
These have been named properties forever*. What's the correct way to implement these? * https://chromium.googlesource.com/chromium/src/+/b6cf53%5E%21/
,
Jul 27 2016
Per the original report at #0, I suppose the following is the spec to be implemented. https://drafts.csswg.org/cssom/#ref-for-cssstyledeclaration-5 Then, each _camel_cased_attribute must be an ordinary regular DOM attribute. You should list all of them up in the .idl file. Seeing the definition of CSSStyleDeclaration interface as below, https://drafts.csswg.org/cssom/#cssstyledeclaration CSSStyleDeclaration interface must not support named properties (though it supports indexed properties).
,
Nov 4 2016
I haven't had time to look into this, unassigning myself.
,
Nov 18 2016
,
Feb 12 2017
,
Apr 3 2017
It sounds like this isn't really P1. Dropping priority.
,
Jul 12 2017
I'm not really sure why this was assigned to me... I'm not likely to work on it any time soon so removing myself.
,
Oct 31 2017
Seems like this is now an interop issue because we're not conforming to a spec?
,
Dec 6 2017
,
Dec 6
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Dec 12
|
||||||||||||||
►
Sign in to add a comment |
||||||||||||||
Comment 1 by esprehn@chromium.org
, Jul 15 2016