I recently wrote the same code against this library's Combinations.of and compared it to very similar code in Python using itertools.combinations. In both cases, I was taking combinations of 200 inputs 3 at a time (a mere 1,313,400 results), iterating over the results with for/of and doing a trivial amount of processing for each combination. The Python itertools version was several orders of magnitude faster for no apparent reason.
input is a list of 200 integers.
JS code node 15.3.0:
for (const [x, y, z] of Combination.of(input, 3)) {
}
Python 3.9.0:
for [x, y, z] in itertools.combinations(input, 3):
I recently wrote the same code against this library's
Combinations.ofand compared it to very similar code in Python usingitertools.combinations. In both cases, I was taking combinations of 200 inputs 3 at a time (a mere 1,313,400 results), iterating over the results with for/of and doing a trivial amount of processing for each combination. The Python itertools version was several orders of magnitude faster for no apparent reason.inputis a list of 200 integers.JS code node 15.3.0:
Python 3.9.0: