-
Notifications
You must be signed in to change notification settings - Fork 512
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
Performance of setStyle #2679
Comments
@oallouch nice input! |
I don't have plenty of time (3 parallel projects), but always for mootools ! |
to be honest you don't need to maintain your own version of mootools for this - just add |
It's the camelCase that hurts most, but, you're right, it comes from an age when we didn't have css animations. |
Hi everyone,
In modern web (or mobile) applications, setStyle can be called millions of times. It's, for me, the most crucial code for good lower level performance.
So, optimization ideas for the Element.setStyle function:
. remove the camelCase(). I've already done it in my version. Try it ! It's great :)
. remove the Math.round around 'val'. With retina screens, sub-pixels become real pixels
. (Element.Styles[property] || '@').split(' ') should be cached. Instead of Strings, Element.Styles values should be Arrays
. if the split array has a length of 1, we don't have to do a "Array.from(value)"
What do you think of it ?
Thx,
Olivier Allouch
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/6506644-performance-of-setstyle?utm_campaign=plugin&utm_content=tracker%2F22067&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F22067&utm_medium=issues&utm_source=github).http://www.illicotravel.com
The text was updated successfully, but these errors were encountered: