Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
filter array
(version: 0)
check is two filter methods is faster that one with two checks
Comparing performance of:
2 filters vs 1 filter, two checks
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const data = [ { id: 1, name: "John", secondname: "Doe", category: "Category 1", phone: "123-456-7890", street: "123 Main Street" }, { id: 2, name: "Jane", secondname: "Smith", category: "Category 2", phone: "456-789-0123", street: "456 Elm Street" }, { id: 3, name: "Alice", secondname: "Johnson", category: "Category 1", phone: "789-012-3456", street: "789 Oak Street" }, { id: 4, name: "Bob", secondname: "Brown", category: "Category 2", phone: "012-345-6789", street: "012 Pine Street" }, { id: 5, name: "Bob", secondname: "Garcia", category: "Category 1", phone: "345-678-9012", street: "345 Cedar Street" } ];
Tests:
2 filters
data.filter(i => i.name === 'Bob').filter(i => i.id === 5)
1 filter, two checks
data.filter(i => i.name === 'Bob' && i.id === 5)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
2 filters
1 filter, two checks
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?