Skip to content

Clock, Timer: Drop fallback to Date.now().#29233

Merged
Mugen87 merged 3 commits intomrdoob:devfrom
satelllte:clock_drop_date_now
Aug 30, 2024
Merged

Clock, Timer: Drop fallback to Date.now().#29233
Mugen87 merged 3 commits intomrdoob:devfrom
satelllte:clock_drop_date_now

Conversation

@satelllte
Copy link
Copy Markdown
Contributor

@satelllte satelllte commented Aug 26, 2024

Related issue: #8112

Description

It's probably a time to drop Date.now fallback in Clock & Timer classes, because the support for high resolution timestamp has already been good for years.

Browser: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
Node: https://nodejs.org/docs/latest-v8.x/api/perf_hooks.html#perf_hooks_performance_now (supported since v8.5.0)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 26, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
685.4 kB (169.7 kB) 685.4 kB (169.7 kB) -38 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
462 kB (111.4 kB) 462 kB (111.4 kB) +0 B

@satelllte satelllte marked this pull request as ready for review August 26, 2024 14:26
@Mugen87
Copy link
Copy Markdown
Collaborator

Mugen87 commented Aug 26, 2024

The newer Timer class in addons/misc/ uses Date.now() as a fallback as well.

return ( typeof performance === 'undefined' ? Date : performance ).now();

While you are at it, please update this module, too.

In any event, give us some time to think about unexpected side effects with this removal.

@satelllte satelllte changed the title Clock: drop support for "Date.now" Clock, Timer: drop support for "Date.now" Aug 26, 2024
@Mugen87 Mugen87 added this to the r169 milestone Aug 28, 2024
@Mugen87
Copy link
Copy Markdown
Collaborator

Mugen87 commented Aug 30, 2024

Let's this a try!

@Mugen87 Mugen87 merged commit f833405 into mrdoob:dev Aug 30, 2024
@Mugen87 Mugen87 changed the title Clock, Timer: drop support for "Date.now" Clock, Timer: Drop fallback to Date.now(). Aug 30, 2024
@satelllte satelllte deleted the clock_drop_date_now branch September 7, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants