-
Notifications
You must be signed in to change notification settings - Fork 159
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
Memory usage of polyfill #683
Comments
@thefliik can't you just put the options bag inside a |
@ryzokuken yes, the following works: Temporal.now.timeZone().getAbsoluteFor(
Temporal.DateTime.from({
year: json.year,
month: json.month,
day: json.day,
hour: json.hour,
minute: json.minute,
second: json.second,
millisecond: json.millisecond,
})
) Though I find it surprising that it's necessary. Not clear why you can't just supply the options object directly as an argument for |
@thefliik - One reason is that the There's also discussion about whether there should be a higher-level-of-abstraction type that combines a Temporal.SomeNewType.from({
timeZone: Temporal.now.timeZone(),
year: json.year,
month: json.month,
day: json.day,
hour: json.hour,
minute: json.minute,
second: json.second,
millisecond: json.millisecond,
}) I'm working on a prototype of this type and will share soon. |
@thefliik Thanks for taking the time to give feedback! Please, if you run into any more things, don't hesitate to open more issues here. The usability issue is also being discussed in #592, could we move the discussion over there?
Agreed, I'd say this is acceptable unless it indicates that future implementations inside a real JS engine might have the same performance problems. That said, any PR on this topic would be welcome. |
I'll change the topic of this issue to reflect the memory performance since we are discussing the |
The polyfill in this repo has now been deprecated. This is a good thing for future polyfills to take into account, so I've copied part of the discussion over to js-temporal/temporal-polyfill#39 |
This issue is a follow up to #148
I maintain a javascript recurring dates library, rSchedule, which happens to be date library agnostic (i.e. it supports
moment
,luxon
,js-joda
, and standardDate
). For fun, I decided to try implementing a date adapter for the temporal polyfill and running it against my tests (can be found in thetemporal-date-adapter-2
branch).Results
The good news is that integrating the current (experimental) version of the temporal polyfill into my library was easy and it successfully passed all of my 29,794 tests (my library has a custom date object that does all the heavy lifting, so these tests don't actually test
proposal-temporal
much).proposal-temporal
polyfill is just intended for experimentation, this performance might be acceptible, but I wanted to pass along the info regardless.Separately, one (small) usability issue I ran into:
Say you have an object like the following and you want to get an
Absolute
You can do
However you can't do the following, which was surprising and slightly annoying.
It would be helpful if
TimeZone#getAbsoluteFor()
accepted a DateTimeLike object.This issue was intended as feedback, so feel free to close.
The text was updated successfully, but these errors were encountered: