adobe-photoshop / spaces-design

Adobe Photoshop Design Space
http://adobe-photoshop.github.io/
Other
851 stars 74 forks source link

Improve performance of switching initialized documents #3696

Closed shaoshing closed 8 years ago

shaoshing commented 8 years ago

This PR improves the performance of switching initialized documents by optimizing the rendering process. When switching documents, we toggle the CSS class "section__active" to show panels of active document and hide the rest of the panels. Before, to just toggle one class, we have to re-render all the panels (Transform, Appearance, Effects, Export, Layers), which adds extra time to the switching. To improve this, this PR wraps the panel components with a div, and toggle the panels by change the class of the div. In this way, the panels can remain unchanged.

Improvements
Before After Diff
switch from an empty doc to vermilion 364ms 256ms -108ms
switch from vermilion to an empty doc 199ms 89ms -110ms

(both documents are already initialized)

iwehrman commented 8 years ago

First impression: the improvement is noticeable. Very nice!

iwehrman commented 8 years ago

This is excellent. I only have some very small suggestions. We should get this merged by the end of the day. Back to @shaoshing!

shaoshing commented 8 years ago

@iwehrman thanks for reviewing. I've addressed your comments. Back to you.

iwehrman commented 8 years ago

LGTM!