Skip to content

Performance of Combination #75

@hildjj

Description

@hildjj

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):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions