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

Temporal support (TC39 stage 3 proposal) #15853

Open
notramo opened this issue Dec 18, 2024 · 15 comments
Open

Temporal support (TC39 stage 3 proposal) #15853

notramo opened this issue Dec 18, 2024 · 15 comments
Labels
enhancement New feature or request

Comments

@notramo
Copy link

notramo commented Dec 18, 2024

What is the problem this feature would solve?

The Temporal API is already supported by Deno and the Boa JS engine.

https://github.com/tc39/proposal-temporal

What is the feature you are proposing to solve the problem?

Implement Temporal in Bun.

What alternatives have you considered?

Slow and heavy polyfills.

@notramo notramo added the enhancement New feature or request label Dec 18, 2024
@maurovanetti

This comment has been minimized.

@kravetsone
Copy link

See temporalio/sdk-typescript#1334 ([Feature Request] Run temporal worker in bun).

Not the same temporal

@maurovanetti
Copy link

See temporalio/sdk-typescript#1334 ([Feature Request] Run temporal worker in bun).

Not the same temporal

This is embarrassing. Sorry. 😊

@TomasHubelbauer
Copy link

This would be great. It looks as though in Safari whose JavaScript engine, JavaScriptCore, Bun is using, has preview support with the useTemporal runtime flag: https://bugs.webkit.org/show_bug.cgi?id=223166 & https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#browser_compatibility

@notramo
Copy link
Author

notramo commented Jan 30, 2025

The patches contain just a stub, only 2 empty objects.

@kravetsone
Copy link

It would be great to have it
-1 dependency

@NuckChorris
Copy link

Looking upstream in JSC, despite the issue showing no movement in years, I see they've got an experimental implementation of Temporal: https://github.com/search?q=repo%3AWebKit%2FWebKit%20Temporal&type=code

I wonder if Bun could enable this experimentally like Deno did with the V8 Temporal implementation 👀

@Jarred-Sumner
Copy link
Collaborator

@NuckChorris try BUN_JSC_useTemporal=1: https://github.com/oven-sh/WebKit/blob/50ae7bfd503f896681ca5a9b848f9822c31c4912/Source/JavaScriptCore/runtime/OptionsList.h#L620

@notramo
Copy link
Author

notramo commented Feb 10, 2025

@Jarred-Sumner, isn't it only for the empty stub Temporal object? Does it enable a usable implementation?

@NuckChorris
Copy link

@notramo I would recommend running the Temporal Test262 Suite against it (if I find time this weekend I might run it and report back) but from the C++ it looks at least vaguely implemented-ish?

@jacksteamdev
Copy link

jacksteamdev commented Feb 18, 2025

Implementation Pass Rate Execution Time Notes
BUN_JSC_useTemporal 40% 0.8s
temporal-polyfill 88% 6s
@js-temporal/polyfill 84% 228s Some >10s Duration tests

It's about 40% there... but the tests run blazing fast! The test runner README estimates ~30s to run, but Bun runs it in 0.8s on my M3.

Image

@kravetsone
Copy link

Implementation Pass Rate Execution Time Notes
BUN_JSC_useTemporal 40% 0.8s
temporal-polyfill 88% 6s
@js-temporal/polyfill 84% 228s Some >10s Duration tests

It's about 40% there... but the tests run blazing fast! The test runner README estimates ~30s to run, but Bun runs it in 0.8s on my M3.

Image

Wants it as much as possible sooner

Because it's really great api

@kravetsone
Copy link

nodejs/node#57128

NodeJS wants to unflag it

@jasnell
Copy link

jasnell commented Feb 19, 2025

Yes, we'd like to unflag it in node.js but still keep it marked as experimental, at least until v8's test coverage numbers are close to 100 and v8 chooses to expose it by default without the flag.

@jasnell
Copy link

jasnell commented Feb 19, 2025

The current thinking is that we likely will not actually merge the PR until after 24.0.0 is cut in April and keep it as experimental until v8's test coverage finally catches up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants