RESOLVED FIXED146866
Web Inspector: Improve runtime of pseudo-element sidebar style ordering
https://bugs.webkit.org/show_bug.cgi?id=146866
Summary Web Inspector: Improve runtime of pseudo-element sidebar style ordering
Devin Rousso
Reported 2015-07-10 18:55:21 PDT
Currently, the algorithm determining where the pseudo-element styles appear in the sidebar has a runtime of O(n^2). This can be improved to O(n) by getting the most specific selector for each rule when that rule is created.
Attachments
Patch (4.72 KB, patch)
2015-07-10 18:58 PDT, Devin Rousso
no flags
Patch (4.87 KB, patch)
2015-07-11 00:02 PDT, Devin Rousso
no flags
Patch (4.87 KB, patch)
2015-07-11 14:33 PDT, Devin Rousso
no flags
Radar WebKit Bug Importer
Comment 1 2015-07-10 18:55:53 PDT
Devin Rousso
Comment 2 2015-07-10 18:58:29 PDT
Timothy Hatcher
Comment 3 2015-07-10 19:55:44 PDT
Comment on attachment 256636 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256636&action=review > Source/WebInspectorUI/UserInterface/Models/CSSRule.js:83 > + this._mostSpecificSelector = this._determineMostSpecificSelector(); This could be in the getter and called when !this._mostSpecificSelector. That way it is as lazy as possible. > Source/WebInspectorUI/UserInterface/Models/CSSRule.js:193 > + if (!this._mostSpecificSelector) This would need to use the getter if you make it lazy. > Source/WebInspectorUI/UserInterface/Models/CSSRule.js:196 > + return this._mostSpecificSelector.isGreaterThan(otherSelector); Ditto. > Source/WebInspectorUI/UserInterface/Models/CSSRule.js:211 > + return; This should be: return null;
Devin Rousso
Comment 4 2015-07-11 00:02:29 PDT
Timothy Hatcher
Comment 5 2015-07-11 00:58:55 PDT
Comment on attachment 256651 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256651&action=review > Source/WebInspectorUI/UserInterface/Models/CSSRule.js:199 > + return; return false; or return true;?
Devin Rousso
Comment 6 2015-07-11 12:18:00 PDT
Comment on attachment 256651 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256651&action=review >> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:199 >> + return; > > return false; or return true;? This is meant to be "return false;". Is it necessary to specify false (since undefined is falsy)?
Timothy Hatcher
Comment 7 2015-07-11 12:21:17 PDT
Comment on attachment 256651 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256651&action=review >>> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:199 >>> + return; >> >> return false; or return true;? > > This is meant to be "return false;". Is it necessary to specify false (since undefined is falsy)? The JIT is happier when types don't change in the flow. We also like to be explicit.
Devin Rousso
Comment 8 2015-07-11 14:33:50 PDT
WebKit Commit Bot
Comment 9 2015-07-11 15:31:04 PDT
Comment on attachment 256667 [details] Patch Clearing flags on attachment: 256667 Committed r186717: <http://trac.webkit.org/changeset/186717>
WebKit Commit Bot
Comment 10 2015-07-11 15:31:08 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.