Does specs have a maximum of 2**20 entities?


#1

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?


#2

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?


#3

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:

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.


#4

Ah, I see. Thanks!