Specs uses hibitset. The BitSet
struct warns that it will panic if more than 1,048,576 indices are added. Does this also limit specs to that number of entities?
1 Like
OK, I've done an experiment and despite the warning, I can add 10M indices to BitSet
without a problem. Why does the documentation contain that warning, then?
Ultimately, it's based on the size of a usize
, which is platform dependent. The number of bits at each layer is conditionally defined here:
https://github.com/slide-rs/hibitset/blob/c0815847271719407966c12547c33f56d93f15d1/src/util.rs#L5-L9
So on a 32 bit machine, you can have 2**(5*4)
~= 1M entities, whereas on a 64 bit machine you can have 2**(6*4)
~= 16M entities.
2 Likes
Ah, I see. Thanks!