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 randomId = () => Math.floor(Math.random() * 10000).toString();
const countryCodes = ['US', 'GR', 'DE', 'FR', 'IT', 'ES', 'NL'];
const languages = ['en', 'de', 'fr', 'it', 'es', 'nl', 'el'];
const benefitValues = ['Health Insurance', 'Retirement Plan', 'Vacation Days', 'Remote Work', 'Childcare', 'Training', 'Bonus', 'Flexible Hours', 'Gym Membership', 'Stock Options', 'Transportation Allowance', 'Meal Vouchers', 'Life Insurance', 'Disability Insurance', 'Dental Coverage', 'Vision Coverage', 'Professional Development', 'Employee Discounts', 'Sabbatical Leave', 'Wellness Programs'];
const getRandomElement = arr => arr[Math.floor(Math.random() * arr.length)];
const getRandomValues = () => {
const count = Math.floor(Math.random() * 21); // Random number between 0 and 20
const shuffled = benefitValues.sort(() => 0.5 - Math.random());
return shuffled.slice(0, count);
};
const generateRandomData = (count = 5) => {
const data = [];
for (let i = 0; i < count; i++) {
const attributes = {
country_code: getRandomElement(countryCodes),
language: getRandomElement(languages),
};
const valuesArray = getRandomValues();
if (valuesArray.length > 0) {
attributes.values = valuesArray;
}
data.push({
attributes,
id: randomId(),
type: 'benefit',
});
}
return data;
};
// Example usage:
const data = generateRandomData(100);
Ready to run.
Test | Ops/sec | |
---|---|---|
FlatMapSet |
| ready |
MapReduce |
| ready |
Set |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.