es-toolkit/benchmarks/maxBy.bench.ts
Jun 3cc1a03519
chore(*): Add codspeed for benchmark visualization (#75)
* chore: add codspeed

* chore: fix the benchmark file to clearly distinguish between the comparison targets

* chore: fix typo
2024-06-18 10:40:07 +09:00

24 lines
610 B
TypeScript
Executable File

import { bench, describe } from 'vitest';
import { maxBy as maxByToolkit } from 'es-toolkit';
import { maxBy as maxByLodash } from 'lodash';
describe('maxBy', () => {
bench('es-toolkit/maxBy', () => {
const people = [
{ name: 'Mark', age: 25 },
{ name: 'Nunu', age: 30 },
{ name: 'Overmars', age: 20 },
];
maxByToolkit(people, person => person.age);
});
bench('lodash/maxBy', () => {
const people = [
{ name: 'Mark', age: 25 },
{ name: 'Nunu', age: 30 },
{ name: 'Overmars', age: 20 },
];
maxByLodash(people, person => person.age);
});
});