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

Return a moment for dates from tasks model #713

Merged
merged 1 commit into from Nov 14, 2019
Merged

Conversation

raimund-schluessler
Copy link
Member

Cloning a moment is 8x faster than creating a moment from a date object. This code

	const iterations = 1000
	const t0 = performance.now()
	for (var j = 0; j < iterations; j++) {
		var tmp = moment(task.due)
	}
	const t1 = performance.now()
	console.debug(`This took ${t1 - t0} ms.`)

	const t2 = performance.now()
	for (var j = 0; j < iterations; j++) {
		var tmp = task.dueMoment
	}
	const t3 = performance.now()
	console.debug(`This took ${t3 - t2} ms.`)

prints

    This took 116.985635 ms.
    This took 15.836432000000059 ms.

I don't know, if this really has a measureable effect on the App itself, but it shouldn't make it slower for sure.

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
@codecov
Copy link

codecov bot commented Nov 14, 2019

Codecov Report

Merging #713 into master will increase coverage by 0.2%.
The diff coverage is 40.74%.

@@            Coverage Diff            @@
##           master     #713     +/-   ##
=========================================
+ Coverage   26.46%   26.66%   +0.2%     
=========================================
  Files          44       44             
  Lines        2086     2104     +18     
  Branches      386      386             
=========================================
+ Hits          552      561      +9     
- Misses       1417     1426      +9     
  Partials      117      117

@raimund-schluessler raimund-schluessler merged commit 88ac946 into master Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant