Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DoctorDerek/cc97857f16f435102501b97b9253a0d2 to your computer and use it in GitHub Desktop.
Save DoctorDerek/cc97857f16f435102501b97b9253a0d2 to your computer and use it in GitHub Desktop.
Array size: 10 items 1,000 items 100,000 items 1,000,000 items
.includes() Fastest Fastest 47.07% slower 46.77% slower
.filter() 97.16% slower 99.99% slower 97.69% slower 97.66% slower
.some() 84.81% slower 99.98% slower 95.11% slower 95.01% slower
for loop 84.2% slower 99.62% slower Fastest Fastest
.find() 85.74% slower 99.98% slower 95.19% slower 95.06% slower
@DoctorDerek
Copy link
Author

JSBench.me test cases: https://jsbench.me/qmkm3wp74g/1
Read the article on Medium: https://medium.com/p/1a8365dfc363

@DoctorDerek
Copy link
Author

Chrome Version 88.0.4324.190 (Official Build) (64-bit), Windows 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment