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

lib: add nowAbsolute to fast timers #3749

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

flakey5
Copy link
Member

@flakey5 flakey5 commented Oct 19, 2024

This adds a nowAbsolute function to the fast timers lib that allows for fetching the approximate absolute timestamp. This is useful in places like the cache interceptor and cache stores, where we're currently calling Date.now().

image

cc @mcollina

test/utils/timers.js Outdated Show resolved Hide resolved
test/utils/timers.js Outdated Show resolved Hide resolved
Copy link
Member

@ronag ronag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can't use the no stall timer.

@ronag
Copy link
Member

ronag commented Oct 19, 2024

Add another variable called fastNowAbsolute which is updated to date.now in every refresh

lib/util/timers.js Outdated Show resolved Hide resolved
@@ -0,0 +1,13 @@
import { bench, group, run } from 'mitata'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of trivial benchmark.

@flakey5 flakey5 force-pushed the flakey5/20241018/now-absolute branch from 152c924 to eb65121 Compare November 2, 2024 08:24
@mcollina
Copy link
Member

mcollina commented Nov 3, 2024

CI is very red

@mcollina
Copy link
Member

Still very red

@flakey5 flakey5 force-pushed the flakey5/20241018/now-absolute branch from b9d2d1a to a8238fd Compare November 14, 2024 05:03
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.

5 participants