Skip to content

Instantly share code, notes, and snippets.

@hildjj
Created January 19, 2021 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hildjj/1e5cf863c25a2f75f8a0ff4c1f8e51c0 to your computer and use it in GitHub Desktop.
Save hildjj/1e5cf863c25a2f75f8a0ff4c1f8e51c0 to your computer and use it in GitHub Desktop.
time node js-combinatorics-slow.js
'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