Skip to main content
tnbnicer
Inspiring
May 6, 2018 7:16 PM UTC
Answered

why does createjs implement less efficient timers

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.

This topic is closed to new replies. Start a new post to keep the conversation going.
tnbnicer
tnbnicerCorrect answer
Inspiring
May 6, 2018 9:34 PM UTC

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.

5 replies

Legend
May 6, 2018 8:48 PM UTC

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?

Translate
kglad
Community Expert
Community Expert
May 6, 2018 8:15 PM UTC

are you sure you're not checking ms?

Translate
tnbnicer
tnbnicerAuthor
Inspiring
May 6, 2018 9:07 PM UTC

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.

Translate
tnbnicer
tnbnicerAuthorCorrect answer
Inspiring
May 6, 2018 9:34 PM UTC

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.

Translate
tnbnicer
tnbnicerAuthor
Inspiring
May 6, 2018 8:06 PM UTC

After more trials ...

The difference is very pronounced in Firefox (58).

Translate