lemire / FastBitSet.js

Speed-optimized BitSet implementation for modern browsers and JavaScript engines
Apache License 2.0
158 stars 19 forks source link

Replace for..of loop with while loop to avoid Internet Explorer syntax errors #7

Closed rasmuskl closed 5 years ago

rasmuskl commented 5 years ago

Unfortunately for..of loops are not supported at all in Internet Explorer, but this is the only part of FastBitSet.js that causes problems - forcing me to put it through Babel or another transpiler which most likely has other performance implications for an optimized library such as this one.

This PR makes a simple change to convert the for..of loop to use the underlying iterator in a while loop.

It also adds a fallback for browsers that do not support iterators properly... (looking at you IE).

The impact on performance should be negligible and only touches set initialization.

Thanks for a great library!

lemire commented 5 years ago

I'm fine with this change, thanks for the contribution.

Maybe one should retire Internet Explorer at some point in the future?

rasmuskl commented 5 years ago

Maybe one should. Down to 2% of my visitors on IE 11 now, so hopefully soon.

But then again the IE users really need the FastBitSet.