DEV Community

Discussion on: Using Array.prototype.includes() vs Set.prototype.has() to filter arrays

Collapse
 
harryjubb profile image
Harry Jubb

Hi, I'm not able to reproduce this in the latest Chrome (94.0.4606.61), running on OS X, even with a large value for n. I also tried in Node, including some older versions.

Was there a particular environment where this is an issue? Maybe Array.prototype.includes has been internally optimized since this was written?

Collapse
 
harryjubb profile image
Harry Jubb

Looks like my image didn't upload, I'm getting:

For n = 100000

includes: 45.72607421875 ms
has: 61.42919921875 ms

For n = 1000000

includes: 367.927978515625 ms
has: 707.369140625 ms