Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental: 2x speedup of StylePanel rendering on selection change #4686

Closed
wants to merge 4 commits into from

Conversation

istarkov
Copy link
Member

@istarkov istarkov commented Dec 31, 2024

Description

Open this
https://p-cfc5b051-3b7a-4a59-a994-44d8d2f8b836-dot-prf.development.webstudio.is/

Start edit, and hold down button.
On my machine edit inputs are switching without serious perf issues in this PR

fast.mov

On my machine on Main https://p-cfc5b051-3b7a-4a59-a994-44d8d2f8b836-dot-main.development.webstudio.is/ it's very slow and finally hangs for a 10+ seconds

hanging.mov

Steps for reproduction

  1. click button
  2. expect xyz

Code Review

  • hi @kof, I need you to do
    • conceptual review (architecture, feature-correctness)
    • detailed review (read every line)
    • test it on preview

Before requesting a review

  • made a self-review
  • added inline comments where things may be not obvious (the "why", not "what")

Before merging

  • tested locally and on preview environment (preview dev login: 0000)
  • updated test cases document
  • added tests
  • if any new env variables are added, added them to .env file

@istarkov istarkov changed the title experimental: Test experimental: 2x speedup of StylePanel rendering on selection change Dec 31, 2024
@istarkov istarkov marked this pull request as ready for review December 31, 2024 09:38
@istarkov istarkov requested review from TrySound and kof December 31, 2024 09:38
new NanostoresSyncObject(
"selectedInstanceBrowserStyle",
$selectedInstanceBrowserStyle
),
new NanostoresSyncObject(
"selectedInstanceIntanceToTag",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectedInstanceIntanceToTag no longer synced from canvas, can be removed too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be synced as selectedInstanceSelector can be set from canvas

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, actually synced when selectInstance is invoked from canvas. Nevermind

// Based on this https://stackoverflow.com/questions/1248081/how-to-get-the-browser-viewport-dimensions/8876069#8876069
// this is crossbrowser way to get viewport sizes vw vh in px
const vw =
Math.max(document.documentElement.clientWidth, window.innerWidth) / 100;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would probably be more accurate if it used some element as a probe, because on mobile, these vh,vw and the newer units that react to keyboard etc is hard to calculate in js

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not this PR issue, lets skip

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather try to put a probe on canvas for any of this detection logic and let css/dom do it

@istarkov
Copy link
Member Author

closed in favor of this #4687

@istarkov istarkov closed this Dec 31, 2024
@istarkov istarkov deleted the prf branch December 31, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants