Skip to main content
tnbnicer
Inspiring
May 6, 2018
Answered

why does createjs implement less efficient timers

  • May 6, 2018
  • 3 replies
  • 636 views

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 has been closed for replies.
Correct answer tnbnicer

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.

3 replies

Legend
May 6, 2018

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?

kglad
Community Expert
Community Expert
May 6, 2018

are you sure you're not checking ms?

tnbnicer
tnbnicerAuthor
Inspiring
May 6, 2018

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.

tnbnicer
tnbnicerAuthorCorrect answer
Inspiring
May 6, 2018

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.

tnbnicer
tnbnicerAuthor
Inspiring
May 6, 2018

After more trials ...

The difference is very pronounced in Firefox (58).