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(format): reuse matches instead of created when replacing #441

Merged
merged 2 commits into from
Feb 2, 2019

Conversation

whatwewant
Copy link
Contributor

as title saying. @iamkun

@codecov-io
Copy link

codecov-io commented Jan 4, 2019

Codecov Report

Merging #441 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #441   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          54     54           
  Lines         481    482    +1     
  Branches       75     75           
=====================================
+ Hits          481    482    +1
Impacted Files Coverage Δ
src/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e185b5...190daa2. Read the comment docs.

@naulacambra
Copy link
Contributor

Using benchmarking configuration that @prantlf done at #344, these are the results before and after aplying the suggested changes

// Before changes
// Run 1
format to ISO 8601
  Moment.js x 575,704 ops/sec ±0.81% (92 runs sampled)
  Day.js x 1,291,353 ops/sec ±0.16% (93 runs sampled)
  Date x 1,282,276 ops/sec ±0.72% (92 runs sampled)
The fastest one was Day.js,Date.

use custom format
  Moment.js x 403,049 ops/sec ±0.87% (92 runs sampled)
  date-fns x 248,510 ops/sec ±0.19% (97 runs sampled)
  Day.js x 92,569 ops/sec ±0.60% (94 runs sampled)
  Date x 110,087 ops/sec ±0.51% (93 runs sampled)
The fastest one was Moment.js.

// Run 2
format to ISO 8601
  Moment.js x 581,482 ops/sec ±0.22% (94 runs sampled)
  Day.js x 1,283,799 ops/sec ±0.45% (91 runs sampled)
  Date x 1,281,516 ops/sec ±0.95% (97 runs sampled)
The fastest one was Day.js.

use custom format
  Moment.js x 398,327 ops/sec ±0.74% (95 runs sampled)
  date-fns x 251,037 ops/sec ±0.26% (91 runs sampled)
  Day.js x 92,943 ops/sec ±0.61% (94 runs sampled)
  Date x 111,424 ops/sec ±0.86% (88 runs sampled)
The fastest one was Moment.js.

// Run 3
format to ISO 8601
  Moment.js x 587,677 ops/sec ±0.36% (94 runs sampled)
  Day.js x 1,283,933 ops/sec ±0.61% (94 runs sampled)
  Date x 1,292,830 ops/sec ±0.45% (94 runs sampled)
The fastest one was Date,Day.js.

use custom format
  Moment.js x 405,805 ops/sec ±0.26% (92 runs sampled)
  date-fns x 246,878 ops/sec ±0.68% (95 runs sampled)
  Day.js x 93,373 ops/sec ±0.48% (95 runs sampled)
  Date x 108,543 ops/sec ±0.87% (96 runs sampled)
The fastest one was Moment.js.

// After changes
// Run 1
format to ISO 8601
  Moment.js x 566,197 ops/sec ±0.44% (96 runs sampled)
  Day.js x 1,278,135 ops/sec ±0.42% (95 runs sampled)
  Date x 1,277,178 ops/sec ±0.53% (98 runs sampled)
The fastest one was Day.js,Date.

use custom format
  Moment.js x 404,481 ops/sec ±0.42% (92 runs sampled)
  date-fns x 246,106 ops/sec ±0.22% (94 runs sampled)
  Day.js x 210,707 ops/sec ±0.46% (94 runs sampled)
  Date x 109,623 ops/sec ±0.55% (94 runs sampled)
The fastest one was Moment.js.

// Run 2
format to ISO 8601
  Moment.js x 581,403 ops/sec ±0.56% (96 runs sampled)
  Day.js x 1,287,142 ops/sec ±0.19% (94 runs sampled)
  Date x 1,266,620 ops/sec ±0.77% (95 runs sampled)
The fastest one was Day.js.

use custom format
  Moment.js x 398,335 ops/sec ±1.04% (94 runs sampled)
  date-fns x 251,269 ops/sec ±0.59% (86 runs sampled)
  Day.js x 213,594 ops/sec ±1.11% (95 runs sampled)
  Date x 110,552 ops/sec ±0.59% (97 runs sampled)
The fastest one was Moment.js.

// Run 3
format to ISO 8601
  Moment.js x 583,860 ops/sec ±0.54% (92 runs sampled)
  Day.js x 1,284,957 ops/sec ±0.32% (97 runs sampled)
  Date x 1,280,988 ops/sec ±0.54% (91 runs sampled)
The fastest one was Day.js,Date.

use custom format
  Moment.js x 375,389 ops/sec ±3.35% (87 runs sampled)
  date-fns x 243,691 ops/sec ±1.03% (94 runs sampled)
  Day.js x 211,566 ops/sec ±1.34% (95 runs sampled)
  Date x 112,007 ops/sec ±0.54% (93 runs sampled)
The fastest one was Moment.js.

There are some improvement, so it seems that this is good to go 😀

@iamkun iamkun merged commit 10b79d8 into iamkun:master Feb 2, 2019
iamkun pushed a commit that referenced this pull request Feb 2, 2019
## [1.8.1](v1.8.0...v1.8.1) (2019-02-02)

### Performance Improvements

* **format:** reuse matches instead of created when replacing ([#441](#441)) ([10b79d8](10b79d8))
@iamkun
Copy link
Owner

iamkun commented Feb 2, 2019

🎉 This PR is included in version 1.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@iamkun iamkun added the released label Feb 2, 2019
andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this pull request May 10, 2022
## [1.8.1](iamkun/dayjs@v1.8.0...v1.8.1) (2019-02-02)

### Performance Improvements

* **format:** reuse matches instead of created when replacing ([#441](iamkun/dayjs#441)) ([10b79d8](iamkun/dayjs@10b79d8))
andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this pull request May 10, 2022
## [1.8.1](iamkun/dayjs@v1.8.0...v1.8.1) (2019-02-02)

### Performance Improvements

* **format:** reuse matches instead of created when replacing ([#441](iamkun/dayjs#441)) ([10b79d8](iamkun/dayjs@10b79d8))
splashwizard pushed a commit to splashwizard/tracking-time that referenced this pull request Oct 21, 2024
## [1.8.1](iamkun/dayjs@v1.8.0...v1.8.1) (2019-02-02)

### Performance Improvements

* **format:** reuse matches instead of created when replacing ([#441](iamkun/dayjs#441)) ([10b79d8](iamkun/dayjs@10b79d8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants