Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

why does createjs implement less efficient timers

Participant ,
May 06, 2018 May 06, 2018

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.

518
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , May 06, 2018 May 06, 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.

Translate
Participant ,
May 06, 2018 May 06, 2018

After more trials ...

The difference is very pronounced in Firefox (58).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 06, 2018 May 06, 2018

are you sure you're not checking ms?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 06, 2018 May 06, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 06, 2018 May 06, 2018
LATEST

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 06, 2018 May 06, 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines