-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
UI refresh() is unusually expensive #99
Comments
i've noticed in sv-palette.ts the colour palette drawing and updating could be optimised. I might be able to have a look at this at some point. Also my friend mentioned that calling the update on mousemove (vs synced to the redraw/frame rate) will do lots of extra work. However that optimisation might require a callback throttle at the higher level to the animation frame. |
I wasnt able to build the repo using 'npm install and npm start' (returned lots of script syntax errors with node 10.15.3 and npm 6.4.1). but if you want to dramatically speed up the sv-palette i would recommend uploading colours to a 64x64 canvas as an array of rgba bytes using ImageData instead of using ctx.fillRect for every pixel. Then scale the canvas to the size you want with css. This will avoid lots of expensive canvas rect antialiasing operations etc and may even give you a smoother gradient image due to the canvas filtering. See more here https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Pixel_manipulation_with_canvas |
Build issues were a windows thing. This change to sv-palette.ts optimised the colour picker rendering. This could be even faster by rendering to a smaller canvas and scaling with css. I think this will help the refresh() performance too.
|
Thank you for using Tweakpane and addressing the issue.
|
Which settings do you mean? My tweakpane object is initialised like this:
and features:
If that helps. |
Applied your optimization to the branch |
Amazing. The colour selector performance is greatly improved by the latest commits. I haven't tried the manual refresh situation yet but will do so if these changes make their way onto npm (to use with my other project). |
Just published the latest version 1.5.6 to npm. |
The latest version on npm is much faster with the colour palettes and the pane refresh. Great work! |
Currently performing pane.refresh() is taking upwards of 120ms to complete and triggers various layout shifts. Is there a way to update ui input values that have been changed in a script without causing this expensive reflow? For example only updating the components whos values have changed?
Also moving the colour picker also seems to be a very expensive operation and causes the animation loop to start juddering. This harms the user experience somewhat when working with realtime graphical applications.
Again thanks for the awesome framework, it's been incredibly useful so far. I wish I could help iron out these performance issues but I am a native / graphics developer and do not have much experience with browser processes etc.
(Ps. you should add a donate button to your site)
The text was updated successfully, but these errors were encountered: