-
Notifications
You must be signed in to change notification settings - Fork 837
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
Dramatic increase in package size #999
Comments
oh, snap, npm publish is dumb, I'll release 0.5.37... |
0.5.37 released |
@ichernev Hmm. This is still an issue for me in 0.5.37. Here's the comparison between: |
This actually looks to me like fixing the bug reported in #768. I suspect that the change in data file sizes is dependent on who is releasing the package. That is, it's based on which version of |
I use Linux, if the issue is really related to that, we could release a few different versions with different year spans. I mean we have bundles (with code) for a few ranges, but the data is only one, which is sad. I'm also not sure if having the actual zone data is not more efficient, than recording changes each year (for many many years in the past/future). |
I just checked -- on a MacOS zdump is 32bit, so it ends around 2047, and on Linux it can go up to 2437. I think the "correct" one is 2437, and then users should select a 10y span if they want less data. I think it makes sense to investigate ingesting direct tz data, which is rule based, so the future is not affected by data size. Also keep in mind that anything that far will likely still be wrong, because it's now popular for governments to mess with DST, so you never know if it won't get changed 3 times by then. |
Hey, what are these |
do we have any updates on this? my package file is over 1000KB now |
Is there any progress on this? |
Hi everyone, I've recently joined the maintenance team for Moment Timezone. I'd like to take the time to explain what's going on with the package size and why "fixing it" isn't necessarily straightforward. ContextIt's not entirely possible to include the IANA time zone data in a
Then there's the differing needs for the size and range of the data:
So reducing the data range fixes package size problems for some users, but causes bugs for other users. Potential solutionI've been thinking about this problem a bit lately and have a different angle. Instead of reducing the range of the data, I suspect there are some great gains to be made by changing how the data is stored. I spent a couple of hours playing with some ideas for further optimising the packed JSON data that makes up the majority of the package size. The best result I've got so far is 22% of the original JSON size (805KB -> 183KB) without any loss of data. There are still some more gains to be made, I reckon. However, I haven't checked how much extra code would need to be added to Moment Timezone itself to handle the new data format, or the runtime performance cost. Changing the format would also technically be a breaking change, so it would need to be handled carefully. Especially since the project is in maintenance-only mode, and things like bundle size issues and major version bumps are documented as out of scope. In summary: I do want to reduce the size of the npm package, but it's not as simple as going back to the way it was before. |
So that all makes sense, but I suppose the important thing to understand here is why has the size of the package suddenly exploded? Would it not make sense to back out whatever changes were made that caused this - and to implement the ability to fetch the 'newer bigger' dataset through a separate package? |
Summarising my earlier comment...
Honestly, I have considered having separate packages for different datasets. I got as far as writing a draft proposal for how it would work. But writing that made me realise how much work it would be (both for the initial setup and for ongoing maintenance), and how many more complications it could cause, which is not viable for the current state of the project. I've also considered reducing the maximum year in the data to either 2100 or (EDIT: See #1039 for more detailed proposals) |
Thanks for taking the time to explain @gilmoreorless, I understand the position you're in now. Packing the data more tightly does seem like the only way 'out' without a complete rearchitecture of the project or taking a dependency on say Intl.Locale.prototype.timeZones which kind of takes the whole point away (as well as not being supported on FF still I think). Like you said before it does seem highly compressible - even I can see that from the output of our vite build which shows our chunk containing moment-timezone be about 1mb but gzipped I think comes down to 300kb or so. Have you thought about using something like messagepack to do the dirty work for you? I don't think its runtime is very large and theres a non-zero chance a lot of projects will include it anyway. |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [moment-timezone](http://momentjs.com/timezone/) ([source](https://togithub.com/moment/moment-timezone)) | [`0.5.5` -> `0.5.41`](https://renovatebot.com/diffs/npm/moment-timezone/0.5.5/0.5.41) | [![age](https://badges.renovateapi.com/packages/npm/moment-timezone/0.5.41/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/moment-timezone/0.5.41/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/moment-timezone/0.5.41/compatibility-slim/0.5.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/moment-timezone/0.5.41/confidence-slim/0.5.5)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>moment/moment-timezone</summary> ### [`v0.5.41`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0541-2023-02-25) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.40...0.5.41) - Updated `moment` npm dependency to `2.29.4` to remove automated warnings about insecure dependencies. Moment Timezone still works with core Moment `2.9.0` and higher. - Updated all dev dependencies including UglifyJS, which produces the minified builds. - Added deprecation warning to the pre-built `moment-timezone-with-data-2012-2022` bundles [#​1035](https://togithub.com/moment/moment-timezone/issues/1035). Use the rolling `moment-timezone-with-data-10-year-range` files instead. ### [`v0.5.40`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0540-2022-12-11) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.39...0.5.40) - Updated data to IANA TZDB `2022g` ### [`v0.5.39`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0539-2022-11-13) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.38...0.5.39) - Updated data to IANA TZDB `2022f` ### [`v0.5.38`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0538-2022-10-15) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.37...0.5.38) - Updated data to IANA TZDB `2022e` - Added `moment.tz.dataVersion` property to TypeScript definitions [#​930](https://togithub.com/moment/moment-timezone/issues/930) - Removed temporary `.tar.gz` files from npm releases [#​1000](https://togithub.com/moment/moment-timezone/pull/1000) ### [`v0.5.37`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0537-2022-08-25) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.36...0.5.37) - Re-publish npm package, because of extra folder present in 0.5.36, check [https://github.com/moment/moment-timezone/issues/999](https://togithub.com/moment/moment-timezone/issues/999)/999 ### [`v0.5.36`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0536-2022-08-25) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.35...0.5.36) - IANA TZDB 2022c - improvements/fixes to data pipeline ### [`v0.5.35`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0535-2022-08-23) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.34...0.5.35) - Fix command injection in data pipeline GHSA-56x4-j7p9-fcf9 - Fix cleartext transmission of sensitive information GHSA-v78c-4p63-2j6c Thanks to the OpenSSF Alpha-Omega project for reporting these! ### [`v0.5.34`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0534-2021-11-10) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.33...0.5.34) - Updated data to IANA TZDB `2021e` ### [`v0.5.33`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0533-2021-02-06) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.32...0.5.33) - Updated data to IANA TZDB `2021a` ### [`v0.5.32`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0532-2020-11-14) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.31...0.5.32) - Updated data to IANA TZDB `2020d` ### [`v0.5.31`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0531-2020-05-16) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.30...0.5.31) - Fixed Travis builds for Node.js 4 and 6 ### [`v0.5.30`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0530-2020-05-16) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.29...0.5.30) - Updated data to IANA TZDB `2020a` - Fixed typescript definitions NOTE: You might need to un-install [@​types/moment-timezone](https://togithub.com/types/moment-timezone). Check [https://github.com/moment/moment-timezone/issues/858](https://togithub.com/moment/moment-timezone/issues/858) for more info ### [`v0.5.29`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0529-2020-05-16) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.28...0.5.29) - Merged fix of es6 module loading issue moment/moment-timezone@1fd4234 - Merged PR with typescript declarations moment/moment-timezone@ed529ea - Merged fixes to changelog moment/moment-timezone@adb7d7b ### [`v0.5.28`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0528-2020-02-21) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.27...0.5.28) Merged pull request [#​410](https://togithub.com/moment/moment-timezone/issues/410) from [@​adgrace](https://togithub.com/adgrace): - Added a method `moment.tz.zonesForCountry(country_code)` which returns all timezones for the country - Added a method `moment.tz(timezone_id).countries()` to get countries for some time zone - Added a method `moment.tz.countries()` to get all country codes - And as you know `moment.tz.zones()` already exists ### [`v0.5.27`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0527-2019-10-14) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.26...0.5.27) - Updated data to IANA TZDB `2019c` ### [`v0.5.26`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0526-2019-06-06) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.25...0.5.26) - Updated data to IANA TZDB `2019b` - Fix: stabilize Array.sort [#​762](https://togithub.com/moment/moment-timezone/pull/762) ### [`v0.5.25`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0525-2019-04-17) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.24...0.5.25) - Fix `moment.tz.dataVersion` to return `2019a` [#​742](https://togithub.com/moment/moment-timezone/issues/742) - Update path in bower.json ### [`v0.5.24`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0524-2019-04-17) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.23...0.5.24) - Updated data to IANA TZDB `2019a` [#​737](https://togithub.com/moment/moment-timezone/issues/737) - Start shipping both a 1970-1930 file and a rolling 10-year file [#​614](https://togithub.com/moment/moment-timezone/issues/614) [#​697](https://togithub.com/moment/moment-timezone/issues/697) - Fixed bug where `_z` time zone name was not cleared with `.local()` or `.utcOffset(offset)` [#​738](https://togithub.com/moment/moment-timezone/issues/738) ### [`v0.5.23`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0523-2018-10-28) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.22...0.5.23) - Fix minor issue with tz guessing in Russia [#​691](https://togithub.com/moment/moment-timezone/pull/691) ### [`v0.5.22`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0522-2018-10-28) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.21...0.5.22) - Updated data to IANA TZDB `2018g` [#​689](https://togithub.com/moment/moment-timezone/pull/689) - Fix issue with missing LMT entries for some zones, and fix data builds on Linux and Windows [#​308](https://togithub.com/moment/moment-timezone/issues/308) ### [`v0.5.21`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0521-2018-06-23) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.20...0.5.21) - Bugfix: revert breaking change introduced in 0.5.18 ### [`v0.5.20`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0520-2018-06-18) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.19...0.5.20) - Bugfix: accidentally commented code ### [`v0.5.19`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0519-2018-06-18) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.18...0.5.19) - Revert: moved moment to peerDependencies ### [`v0.5.18`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0518-2018-06-18) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.17...0.5.18) - Return error when timezone name is not a string. - Moved moment to peerDependencies [#​628](https://togithub.com/moment/moment-timezone/pull/628) - Prefer nodejs to amd declaration [#​573](https://togithub.com/moment/moment-timezone/pull/573) ### [`v0.5.17`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0517-2018-05-12) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.16...0.5.17) - Updated data to IANA TZDB `2018d`. [#​616](https://togithub.com/moment/moment-timezone/pull/616) ### [`v0.5.16`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0516-2018-04-18) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.15...0.5.16) - Fixed Etc/UTC timezone recognition, updated tests. [#​599](https://togithub.com/moment/moment-timezone/pull/599) - Updated minified files to contain IANA TZDB `2018d` data ### [`v0.5.15`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0515-2018-04-17) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.14...0.5.15) - Updated data to IANA TZDB `2018d`. [#​596](https://togithub.com/moment/moment-timezone/pull/596) ### [`v0.5.14`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0514-2017-10-30) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.13...0.5.14) - Ensure Intl response is valid when guessing time zone. [#​553](https://togithub.com/moment/moment-timezone/pull/553) - Updated data to IANA TZDB `2017c`. [#​552](https://togithub.com/moment/moment-timezone/pull/552) - Convert to tz keeping wall time [#​505](https://togithub.com/moment/moment-timezone/pull/505) - Make all time zones available for guessing. [#​483](https://togithub.com/moment/moment-timezone/pull/483) - zone.offset has been deprecated in favor of zone.utcOffset [#​398](https://togithub.com/moment/moment-timezone/pull/398) - Check for timestamp formats when parsing [#​348](https://togithub.com/moment/moment-timezone/pull/348) ### [`v0.5.13`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0513-2017-04-04) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.12...0.5.13) - Bumped version to address Bower cache issues with last release. [#​474](https://togithub.com/moment/moment-timezone/issues/474) - (No actual changes otherwise) ### [`v0.5.12`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0512-2017-04-02) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.11...0.5.12) - Updated data to IANA TZDB `2017b`. [#​422](https://togithub.com/moment/moment-timezone/pull/460) - Build the truncated data file as 2012-2022 (+/- 5 years). ### [`v0.5.11`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0511-2016-12-23) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.10...0.5.11) - Remove log statement when data is loaded twice. [#​352](https://togithub.com/moment/moment-timezone/pull/352) ### [`v0.5.10`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​0510-2016-11-27) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.9...0.5.10) - Updated data to IANA TZDB `2016j`. [#​422](https://togithub.com/moment/moment-timezone/pull/422) ### [`v0.5.9`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​059-2016-11-03) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.8...0.5.9) - Fixed the output of `moment.tz.version`. [#​413](https://togithub.com/moment/moment-timezone/issues/413) ### [`v0.5.8`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​058-2016-11-03) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.7...0.5.8) - Updated data to IANA TZDB `2016i`. [#​411](https://togithub.com/moment/moment-timezone/pull/411) ### [`v0.5.7`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​057-2016-10-21) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.6...0.5.7) - Updated data to IANA TZDB `2016h`. [#​403](https://togithub.com/moment/moment-timezone/pull/403) ### [`v0.5.6`](https://togithub.com/moment/moment-timezone/blob/HEAD/changelog.md#​056-2016-10-08) [Compare Source](https://togithub.com/moment/moment-timezone/compare/0.5.5...0.5.6) - Updated data to IANA TZDB `2016g`. [#​394](https://togithub.com/moment/moment-timezone/pull/394) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 3am on Monday" in timezone America/New_York, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/openedx/edx-ui-toolkit). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMDIuNCIsInVwZGF0ZWRJblZlciI6IjM0LjE1Mi40In0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
I've fleshed out some of the proposed changes around data size and breaking changes at #1039, for those interested. |
Moment-timezone version which you use:
Version: 0.5.36
Note: many issues are resolved if you just upgrade to the latest version
Issue description:
Package has increased size dramatically and AWS lambda layer rejecting the size. Seems it has gotten one additional folder in package - temp.back - which was not there in previous version.
The text was updated successfully, but these errors were encountered: