Skip to content

Int vs BigInt for length of combinatorial iterators #5543

@mjrodgers

Description

@mjrodgers

We have some iterators in EnumerativeCombinatorics that return a BigInt as their length, and a PR review brought up the question of whether this is useful / necessary.

These numbers can get quite large, for example binomial(40,20) is ~ 2^37.

Is an Int always 64 big in Julia or is it sometimes 32 bit depending on the system? And how reasonable is it to work with these iterators? We can collect combinations(30,15) (about 2^27 objects) in about 200 seconds, but about 95% of that is garbage collection time, we can iterate over it in 3 seconds with inplace=true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions