jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
function isEqual(obj1, obj2) {
return JSON.stringify(obj1) === JSON.stringify(obj2);
}
const mapFromColors = new Map();
const uniqueSet = new Set();
const uniqueArraySet = new Set();
function generateHash(inputString) {
let hash = 0;
for (let i = 0; i < inputString.length; i++) {
const char = inputString.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash |= 0; // Convert to 32bit integer using bitwise OR
}
return hash;
}
// Example array with duplicate objects
const arrayWithDuplicates = [
{
"id": 1,
"name": "Alice",
"details": {
"age": 30,
"city": "New York"
}
},
{
"id": 2,
"name": "Bob",
"details": {
"age": 25,
"city": "Los Angeles"
}
},
{
"id": 3,
"name": "Alice",
"details": {
"age": 30,
"city": "New York"
}
},
{
"id": 4,
"name": "Charlie",
"details": {
"age": 35,
"city": "Chicago"
}
},
{
"id": 1,
"name": "Alice",
"details": {
"age": 30,
"city": "New York"
}
},
{
"id": 2,
"name": "Bob",
"details": {
"age": 25,
"city": "Los Angeles"
}
},
{
"id": 3,
"name": "Alice",
"details": {
"age": 30,
"city": "New York"
}
},
{
"id": 2,
"name": "Bob",
"details": {
"age": 25,
"city": "Los Angeles"
}
},
{
"id": 3,
"name": "Alice",
"details": {
"age": 30,
"city": "New York"
}
},
{
"id": 2,
"name": "Bob",
"details": {
"age": 25,
"city": "Los Angeles"
}
},
{
"id": 3,
"name": "Alice",
"details": {
"age": 30,
"city": "New York"
}
},
{
"id": 8,
"name": "Bobb",
"details": {
"age": 25,
"city": "Los Angeles"
}
},
{
"id": 9,
"name": "Alicee",
"details": {
"age": 30,
"city": "New York"
}
},
{
"id": 4,
"name": "Charlie",
"details": {
"age": 35,
"city": "Chicago"
}
},
{
"id": 1,
"name": "Alice",
"details": {
"age": 30,
"city": "New York"
}
},
{
"id": 2,
"name": "Bob",
"details": {
"age": 25,
"city": "Los Angeles"
}
},
{
"id": 3,
"name": "Alice",
"details": {
"age": 30,
"city": "New York"
}
},
{
"id": 4,
"name": "Charliee",
"details": {
"age": 35,
"city": "Chicago"
}
}
];
Ready to run.
Test | Ops/sec | |
---|---|---|
Filter |
| ready |
For |
| ready |
Map |
| ready |
For map |
| ready |
Optimized |
| ready |
Set |
| ready |
Opimized Set |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.