adobe-photoshop / spaces-design

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

Reduce cost of updating panel sizes #3684

Closed iwehrman closed 8 years ago

iwehrman commented 8 years ago

This PR makes three changes to avoid unnecessary action calls to update the cloaking rectangle in the adapter:

  1. Factor commitPanelSizes out of updatePanelSizes. The former commits changes to the adapter, while the latter only updates the bounds in the panel store.
  2. Do not call commitPanelSizes until all panels have been initialized. This should make the calls that happen before beforeStartup less costly.
  3. Once all panels are initialized, use a debounced version of commitPanelSizes to avoid committing unnecessarily. This should avoid repeatedly committing stale panel size values when, e.g., dragging a window from one display to another.

@shaoshing: I haven't convinced myself that this leads to any concrete improvements. Can you take a look and make a judgement call about whether this extra complexity is warranted? I'm not sure myself yet.

shaoshing commented 8 years ago

This looks good! It has reduced the number of adapterUI calls from 8 to 2 during startup. I don't see significant performance boost either (I saw the adapterUI calls are completed within 1ms), but it definitely make the action calls more clear (and less console outputs), so I think we should get this in.

shaoshing commented 8 years ago

@iwehrman I am ready to merge this, just got one question about the JSDoc. Back to you.

iwehrman commented 8 years ago

Thanks for the review. JSDoc issue addressed. Back to @shaoshing!

shaoshing commented 8 years ago

Sweet!