moment vs date

Benchmark created on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.30.1/moment.min.js" integrity="sha512-hUhvpC5f8cgc04OZb55j0KNGh4eh7dLxd/dPSJ5VyzqDWxsayYbojWyl5Tkcgrmb/RVKCRJI1jNlRbVP4WWC4w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
moment
let res;
for (let i = 0; i < 100; i++) {
	res = moment().unix()
}
ready
date
let res;
for (let i = 0; i < 100; i++) {
	res = Math.round((new Date()).getTime() / 1000)
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.