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
const singlePost = [
{
id: 4,
title: "post 01",
slug: "slug 01",
author: {
id: 1,
email: "arup@gmail.com"
},
category: {
id: 1,
name: "taxonomy-01",
slug: "taxonomy-01"
}
},
{
id: 4,
title: "post 01",
slug: "slug 01",
author: {
id: 1,
email: "arup@gmail.com"
},
category: {
id: 2,
name: "taxonomy-02",
slug: "taxonomy-02"
}
}
];
const newData = [];
for (const current of singlePost) {
let existingPost = newData.find(post => post.id === current.id);
if (existingPost) {
existingPost.category.push(current.category); // Add category to existing post
} else {
newData.push({ ...current, category: [current.category] }); // Create new post with category array
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
dd |
| ready |
fsf |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.