Closed
Bug 1329147
Opened 7 years ago
Closed 7 years ago
Optimize rendering of the RequestListItem component
Categories
(DevTools :: Netmonitor, defect, P1)
DevTools
Netmonitor
Tracking
(firefox53 fixed)
Tracking | Status | |
---|---|---|
firefox53 | --- | fixed |
People
(Reporter: jsnajdr, Assigned: jsnajdr)
References
(Blocks 1 open bug)
Details
(Whiteboard: [netmonitor])
Attachments
(1 file)
Profiling the React/Redux implemenation of Netmonitor UI with Cleopatra tells me that a lot of time is spent when rendering the RequestListItem component. Subcomponents like CauseColumn or MethodColumn will never change after the first render, yet they are rerendered on every update. My patch will do the following optimizations: 1. Convert all the *Column components into classes (they are stateless functional components now) and implement a suitable shouldComponentUpdate on them. This will prevent redundant calls to render(). 2. Optimize how the properties are compared in shouldComponentUpdate. Property access in Immutable.Record is rather expensive. So, I'm reordering the property names in RELEVANT_ITEM_PROPS (renamed to UPDATED_REQ_ITEM_PROPS) so that the ones most likely to be different are the first: mimeType, eventTimings, securityState, responseContentDataUri.
Assignee | ||
Updated•7 years ago
|
Comment hidden (mozreview-request) |
Updated•7 years ago
|
Status: NEW → ASSIGNED
Iteration: --- → 53.4 - Jan 9
Flags: qe-verify?
Priority: -- → P1
Whiteboard: [netmonitor-triage] → [netmonitor]
Comment 2•7 years ago
|
||
mozreview-review |
Comment on attachment 8824370 [details] Bug 1329147 - Optimize rendering of RequestListItem https://reviewboard.mozilla.org/r/102892/#review103670 Thanks for the patch Jarda, looks good to me. Just a few minor inline comments. R+ assuming try is green. Also, it isn't related to this patch but, I have noticed that timing labels are not visible sometimes and reported bug 1329481 Honza ::: devtools/client/netmonitor/components/request-list-item.js:18 (Diff revision 1) > /** > + * Compare two objects on a subset of their properties > + */ > +function propertiesEqual(props, item1, item2) { > + return item1 === item2 || props.every(p => item1[p] === item2[p]); > +} I think that it would be better to put helper functions at the bottom of the file. ::: devtools/client/netmonitor/components/request-list-item.js:67 (Diff revision 1) > onContextMenu: PropTypes.func.isRequired, > onMouseDown: PropTypes.func.isRequired, > onSecurityIconClick: PropTypes.func.isRequired, > }, > > componentDidMount() { We are probably not respecting the rule much, but there should be space between function name and parenthases. componentDidMount() -> componentDidMount () This should be done in separate bug as a bulk change though. ::: devtools/client/netmonitor/components/request-list-item.js:202 (Diff revision 1) > -function FileColumn(item) { > - const { urlDetails, responseContentDataUri } = item; > +const UPDATED_FILE_PROPS = [ > + "urlDetails", > + "responseContentDataUri", > +]; > + > +const FileColumn = createFactory(createClass({ It would be great if every component has general comment explaining the purpose.
Attachment #8824370 -
Flags: review?(odvarko) → review+
Assignee | ||
Comment 3•7 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] from comment #2) > I think that it would be better to put helper functions at the bottom of the > file. I'll move them before landing. > We are probably not respecting the rule much, but there should be space > between function name and parenthases. > > componentDidMount() -> componentDidMount () No, componentDidMount() is correct according to our eslint rules. Space is required only after the function keyword: function () { } And that rule for "function" is there only because of compatibility with generator syntax. Here is an issue I filed for eslint back in May, but never got (and probably never will) get around to actually fix it: https://github.com/eslint/eslint/issues/6195 > > +const FileColumn = createFactory(createClass({ > > It would be great if every component has general comment explaining the > purpose. In this case, the comment would say only "This is a component that renders the File column". Which is already perfectly obvious from the component name and code. I don't know what else should be explained there.
Pushed by jsnajdr@gmail.com: https://hg.mozilla.org/integration/autoland/rev/980a5c4e312a Optimize rendering of RequestListItem r=Honza
Updated•7 years ago
|
Flags: qe-verify? → qe-verify-
Comment 5•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/980a5c4e312a
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox53:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 53
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•