Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
JQuery.grep vs Array.filter
Compare how to find need element with different functions
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
$.grep
1.3M/s
Array.filter
1.2M/s
View exact numbers
Test name
Executions per second
✓
$.grep
1,326,248 Ops/sec
Array.filter
1,217,797 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js'></script>
Script Preparation code:
var array = [{id: "1", name: "1"}, {id: "2", name: "2"}, {id: "3", name: "3"}, {id: "4", name: "4"}, {id: "5", name: "5"}] var needId = "3";
Tests:
$.grep
$.grep(array, function (element) { return element.id === needId; });
Array.filter
array.filter(function (element) { return element.id === needId; });