_.any vs .some

Benchmark created on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.6/underscore-min.js"></script>

Setup

const users = [];
for (let i = 0; i < 1000; i++) {
  users.push({
    id: i,
    name: 'User ' + i,
    age: Math.floor(Math.random() * 80) + 18,
    isActive: Math.random() > 0.5,
    score: Math.random() * 100
  });
}

const predicate = (user) => user.age > 65 && user.score > 80;

Test runner

Ready to run.

Testing in
TestOps/sec
_.any
_.any(users, predicate);
ready
.some
users.some(predicate);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.