Created
January 19, 2021 20:35
-
-
Save hildjj/1e5cf863c25a2f75f8a0ff4c1f8e51c0 to your computer and use it in GitHub Desktop.
time node js-combinatorics-slow.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const req = require('esm')(module) | |
const {Combination} = req('js-combinatorics') | |
const a = Array.from(new Array(200), (_, i) => i) | |
let tot = 0 | |
for (const [x, y, z] of Combination.of(a, 3)) { | |
tot += x*y*z | |
} | |
console.log(tot) | |
// 1287230505000 | |
// node js-combinatorics-slow.js 199.87s user 0.83s system 99% cpu 3:21.38 total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment