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 availableOption = {
name: 'alpha',
choices: [
{
name: 'one',
id: 1,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'two',
id: 2,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'three',
id: 3,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'four',
id: 4,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'five',
id: 5,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'six',
id: 6,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
],
};
const givenOption = {
name: 'beta',
choices: [
{
name: 'three',
id: 3,
selected: true,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'two',
id: 2,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'six',
id: 6,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'one',
id: 1,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'five',
id: 5,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
{
name: 'four',
id: 4,
selected: false,
quantity: 0,
fractionalQuantity: 0,
},
],
};
const availableOptions = [
{...availableOption},
{...availableOption},
{...availableOption},
{...availableOption},
{...availableOption},
];
const givenOptions = [
{...givenOption},
{...givenOption},
{...givenOption},
{...givenOption},
{...givenOption},
];
function choiceIsSelected (choice) {
return choice.selected || choice.quantity > 0 || choice.fractionalQuantity > 0;
}
function choiceIsUserSet(choice) {
const isIncluded = false;
const isSelected = choiceIsSelected(choice);
return (isSelected && !isIncluded) || (!isSelected && isIncluded);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
filter after |
| ready |
filter before |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.