_.filter vs .filter (v4)

Revision 4 of this 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 = Array.from({ length: 1000 }, (_, i) => ({
  id: i,
  name: `User${i}`,
  age: Math.floor(Math.random() * 80) + 18,
  active: Math.random() > 0.3
}));


const predicate = (user) => user.active && user.age > 25;

Test runner

Ready to run.

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

Revisions

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