tween.js icon indicating copy to clipboard operation
tween.js copied to clipboard

Investigate strict mode performance

Open mikebolt opened this issue 9 years ago • 7 comments

We may be able to get a performance boost by using JavaScript's strict mode in our library. Someone should test performance with and without strict mode in different browsers. The bars example (examples/01_bars.html) could be a good way to test the performance, especially when combined with a profiling tool.

mikebolt avatar Aug 11 '16 05:08 mikebolt

I get 3-5fps lower than "non-strict", i interested to this, because, my js based on tween.js

dalisoft avatar Aug 16 '16 13:08 dalisoft

I got the same drop in framerate when switching both Tween.js and the script in 01_bars.html to strict mode.

However, it looks like the issue is the following code in 01_bars.html:

var updateCallback = function() {
    this.domElement.style.left = this.x + 'px';
}

This code is taking most of the CPU time and it runs slower in strict mode. I did another test by turning strict mode on only in Tween.js, and the performance was better in strict mode.

We should run some performance tests with the other examples.

mikebolt avatar Aug 28 '16 23:08 mikebolt

@mikebolt Yes, we need some examples for performance. I interested. Contact me via e-mail, if i need in tests

dalisoft avatar Aug 29 '16 19:08 dalisoft

@mikebolt If we can get performance that you said as improved. We can catch GSAP Performance. It's very amazing, yes?

dalisoft avatar Aug 29 '16 19:08 dalisoft

This is probably a good moment to remind ourselves that we actually do not have a way of measuring performance properly! I created this issue to start a discussion about it: https://github.com/tweenjs/discuss/issues/3

sole avatar Oct 03 '16 11:10 sole

@mikebolt I removed 'good first bug' because I don't think it's reasonable to expect someone to solve the 'benchmark performance' issue and 'strict mode performance' in just one go =)

sole avatar Oct 03 '16 11:10 sole

You can see my note about it here

with "use strict" performance maybe improved by almost 15%, but some Android <5 has bugs with "use strict" and may not load script and tweening doesn't runs. Sorry :(. If you want use it, please just paste

(function(){
    "use strict"; // here paste

and done. You have better performance :)

dalisoft avatar Dec 12 '16 04:12 dalisoft