Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Aug 30, 2024

Conversation

satelllte
Copy link
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)

Copy link

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
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
Collaborator

Mugen87 commented Aug 30, 2024

Let's this a try!

@Mugen87 Mugen87 merged commit f833405 into mrdoob:dev Aug 30, 2024
12 checks passed
@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