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 newColumns = [
'_lastMessage',
'demandIntent.ownedByAccount.account_type_label',
'demandIntent.ownedByBuyerType',
'tableData.signedNda',
'tableData.displayStatusKey',
'tableData.demandClient',
'demandIntent.assignedToUser.full_name',
'_contactRating',
];
function sortColumnsA_() {
const defaultOrder = [
'tableData.displayStatusKey',
'tableData.demandClient',
'demandIntent.assignedToUser.full_name',
'_contactRating',
'_lastMessage',
'demandIntent.ownedByAccount.account_type_label',
'demandIntent.ownedByBuyerType',
'tableData.signedNda',
];
return function (a, b) {
if (defaultOrder.indexOf(a) > defaultOrder.indexOf(b)) {
return 1;
} else if (defaultOrder.indexOf(a) < defaultOrder.indexOf(b)) {
return -1;
} else {
return 0;
}
};
}
sortColumnsA = sortColumnsA_();
function sortColumnsB(newColumns) {
const defaultOrder = [
'tableData.displayStatusKey',
'tableData.demandClient',
'demandIntent.assignedToUser.full_name',
'_contactRating',
'_lastMessage',
'demandIntent.ownedByAccount.account_type_label',
'demandIntent.ownedByBuyerType',
'tableData.signedNda',
];
const output = [];
for (var column of defaultOrder) {
if (newColumns.includes(column)) {
output.push(column);
}
}
return output;
}
console.log(newColumns.sort(sortColumnsA));
console.log(sortColumnsB(newColumns));
Ready to run.
Test | Ops/sec | |
---|---|---|
sortColumnsA |
| ready |
sortColumnsB |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.