Copy link to clipboard
Copied
Hi.
In my animation sequence an object redraws approximately 100 times at regular intervals. To start the process there is a timer.
Comparing the performances of
a) start = createjs.Ticker.getTime(true);
and
b) start = performance.now();
The same process requires almost 20 seconds with the Ticker compared with performance.now(), about 12-15 seconds. This is not exaggerated.
Can anyone explain why there is such a huge difference at a constant framerate? 20. Does performance.now() ignore the framerate and set its own default -- higher?
Moreover, createjs.Ticker appears incapable of the high speed even when raising the framerate.
createjs.Ticker.framerate = 60;
Hardly any difference.
Thanks in advance.
My description of the procedure was somewhat loose. After setting a timestamp, of course, I checked the new time against the timestamp to achieve time intervals.
I started down the track of trying different timer methods, because in Flash I always used the Date.now() method to set a timestamp and to time events. Createjs provided an alternative. performance.now() another. Being interested in efficiency I tried both, but they're the same, it turns out.
Copy link to clipboard
Copied
After more trials ...
The difference is very pronounced in Firefox (58).
Copy link to clipboard
Copied
are you sure you're not checking ms?
Copy link to clipboard
Copied
After many more stop-watched trials ...
I noticed what I was doing. In the performance.now() runs, I left the framerate set to sixty. That more or less explains it. There are huge differences between browsers (Chrome - 12s; FF - 15s, IE and Edge - 17s), which also threw me off, but regardless of the timer. On a small laptop the average was about 20s.
Sorry about that. My mistake. There in fact should not be a discrepancy, since create.Ticker implements performance.now() with a fallback method for browsers that don't support it, for instance IE9. (So I read.)
A most unlikely scenario. Again, sorry for the red herring.
Thanks for the reply.
Copy link to clipboard
Copied
My description of the procedure was somewhat loose. After setting a timestamp, of course, I checked the new time against the timestamp to achieve time intervals.
I started down the track of trying different timer methods, because in Flash I always used the Date.now() method to set a timestamp and to time events. Createjs provided an alternative. performance.now() another. Being interested in efficiency I tried both, but they're the same, it turns out.
Copy link to clipboard
Copied
I really have no idea what you're talking about. Both of the code lines you posted just return a timestamp. What does efficiency or performance have anything to do with that?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now