Message from JavaScript discussions
May 2017
— Linearly :p
I think a Bloom filter of the set would make it very fast 99% of the time. Quite literally 99%, with a 1% chance of error (and subsequent mitigation of error IE manual check)
— Although error rate is affected by size of the hash vs number of items in the set
— On removals, you could just regenerate the bit array
— Which sounds slow, but is as efficient as linear enumeration in the first place
— You can only get false positives, but never false negatives
— Which, for the purpose of "if not X then add X" works great, since you can know that an item is definitely not in the set and act accordingly. If you get a false positive, you can adjust the size of the bit array to reduce the chance to a very low one. Probably reflective of UTF-8 bytes
— Hmm
— Well....
— I implemented the array thing...
— It's very fast for adding
— Yay :D