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

Perf: Add benchmark for DateTime.local with zone #1574

Merged

Conversation

schleyfox
Copy link
Contributor

@schleyfox schleyfox commented Jan 22, 2024

This is part of a series of PRs based on performance work we have done to
improve a use-case involving parsing/formatting hundreds of thousands of dates
where luxon was the bottleneck.

We found that time zone handling took up a lot of time. This adds a benchmark around this for DateTime.local (which uses quickDT and is the fastest path for creating DateTimes from date components. This also renames the existing DateTime.local benchmark to be DateTIme.now as it calls DateTime.now rather than local

DateTime.now x 3,076,386 ops/sec ±0.16% (98 runs sampled)
DateTime.fromObject with locale x 1,112,953 ops/sec ±0.08% (99 runs sampled)
DateTime.local with numbers x 844,898 ops/sec ±0.15% (100 runs sampled)
DateTime.local with numbers and zone x 50,913 ops/sec ±0.18% (97 runs sampled)
DateTime.fromISO x 329,144 ops/sec ±0.32% (98 runs sampled)
DateTime.fromSQL x 460,943 ops/sec ±0.16% (101 runs sampled)
DateTime.fromFormat x 60,666 ops/sec ±0.17% (100 runs sampled)
DateTime.fromFormat with zone x 26,687 ops/sec ±0.18% (100 runs sampled)
DateTime#setZone x 175,791 ops/sec ±0.29% (96 runs sampled)
DateTime#toFormat x 1,029,132 ops/sec ±0.15% (99 runs sampled)
DateTime#toFormat with macro x 450,668 ops/sec ±0.32% (95 runs sampled)
DateTime#toFormat with macro no cache x 12,197 ops/sec ±9.62% (80 runs sampled)
DateTime#add x 351,727 ops/sec ±3.49% (100 runs sampled)
DateTime#toISO x 6,169,310 ops/sec ±0.15% (100 runs sampled)
DateTime#toLocaleString x 517,180 ops/sec ±0.36% (98 runs sampled)
DateTime#toLocaleString in utc x 236,294 ops/sec ±0.34% (99 runs sampled)
DateTime#toRelativeCalendar x 14,076 ops/sec ±0.32% (95 runs sampled)
Fastest is DateTime#toISO
Info.months with existing locale x 52,033,486 ops/sec ±0.10% (100 runs sampled)
Info.months x 11,068,821 ops/sec ±0.47% (95 runs sampled)
Fastest is Info.months with existing locale
Info.monthsFormat with existing locale x 42,476,619 ops/sec ±1.00% (95 runs sampled)
Info.monthsFormat x 9,895,981 ops/sec ±0.26% (98 runs sampled)
Fastest is Info.monthsFormat with existing locale
Info.weekdays with existing locale x 43,636,745 ops/sec ±1.08% (99 runs sampled)
Info.weekdays x 12,718,724 ops/sec ±0.21% (98 runs sampled)
Fastest is Info.weekdays with existing locale
Info.weekdaysFormat with existing locale x 37,275,570 ops/sec ±0.67% (98 runs sampled)
Info.weekdaysFormat x 13,117,957 ops/sec ±0.62% (98 runs sampled)
Fastest is Info.weekdaysFormat with existing locale

Copy link

linux-foundation-easycla bot commented Jan 22, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: schleyfox / name: Ben Hughes (def2eac)

@schleyfox schleyfox changed the title Add benchmark for DateTime.local with zone Perf: Add benchmark for DateTime.local with zone Jan 22, 2024
@schleyfox schleyfox marked this pull request as ready for review January 22, 2024 16:50
@icambron icambron merged commit 61baaf8 into moment:master Mar 9, 2024
1 check passed
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.

2 participants