luxon
luxon copied to clipboard
Perf: Summary of all perf changes. DO NOT MERGE.
We have worked to improve luxon performance for our use case of parsing/formatting hundreds of thousands of dates at a time. These are represented as a series of independent PRs
perf
- https://github.com/moment/luxon/pull/1574
- https://github.com/moment/luxon/pull/1576
- https://github.com/moment/luxon/pull/1579
- https://github.com/moment/luxon/pull/1580
- https://github.com/moment/luxon/pull/1581
- https://github.com/moment/luxon/pull/1582
bug fix/quality of life
- https://github.com/moment/luxon/pull/1575
- https://github.com/moment/luxon/pull/1583
While each perf-related PR improves perf on its own, we see the most benefit when they are all combined (especially for time zone offset handling).
Benchmark Comparison (name | before | after | after/before
):
DateTime.fromObject with locale | 1,112,953 ±0.08% | 1,229,589 ±0.17% | 1.1x
DateTime.local with numbers | 844,898 ±0.15% | 965,500 ±0.15% | 1.14x
DateTime.local with numbers and zone | 50,913 ±0.18% | 183,955 ±0.17% | 3.61x
DateTime.fromFormat | 60,666 ±0.17% | 115,620 ±0.21% | 1.91x
DateTime.fromFormat with zone | 26,687 ±0.18% | 56,353 ±0.23% | 2.11x
DateTime.fromFormatParser | | 418,416 ±0.12%
DateTime.fromFormatParser with zone | | 98,700 ±0.24%
fromFormat vs. fromFormatParser | 60,666 ±0.17% | 418,416 ±0.12% | 6.9x
fromFormat vs. fromFormatParser with zone | 26,687 ±0.18% | 98,700 ±0.24% | 3.7x
DateTime#setZone | 175,791 ±0.29% | 301,550 ±0.34% | 1.72x
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: schleyfox / name: Ben Hughes (def2eac1eb90efb933f1db20d1b7039f1c668ff2, 6072eba65bea0f72ee21df3ff4e02ef1d1286aed, 5fa43cd5a8b219ff31d3f97d68164dfeec7aae0f, c5bd5fd539179af4ee4d8685e9c0550851a763eb, 3e363ee6a729735c8ec5cdf52827ff2840d4337d, b56224e0a7f5cfa402750cfd3a96e911f8230157, c7e40aceec56f0062e5354f4b209e6913fed6de5, 87fd3ff3823eae941c1995735c2a4431a31ce1b5, feaf06dbf8cf5a912114e6f47f2bd0995b5331c6, 5b708a2fb82e77d7ca863238d39f04979265ceb3, bfb703b894225e6b6d25fee5607e5bb117143dae, ca5017901a5a128eef9264ebe424ab2d778aa3e7, 4120aeb1bceabffd9a384aaf7d2ec8ce80b51f13, 7684257a80b358151d291d62945e2ca90ddae632, fc5bb2852e00da4e5eac6ab1c292fef5f9c64a08, 795082a85846573fa6635e1539a20ecfb0128dd5)
/easycla
@schleyfox Hey Ben -- these are great, and I really like the effort and depth here. I've merged most of them. The remaining items are:
- #1579 - has a conflict
- #1580 - had a question, also thinking about the item in general
- #1583 - i'm pretty uncomfortable with this one until i understand better exactly what it does for "regular" npm users
@icambron thanks!
for #1579 I'll get that fixed shortly
for #1580 I'll benchmark that and respond, should be straightforward.
for #1583 totally! It's been on my backlog to docker up an example to see how the npm hooks behave under different conditions (I'm quite confused), but I haven't had a chance yet.
Sorry for taking so long to release these. But now that they're out, I think we can close this uber PR