mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 20:26:33 +03:00
18 lines
508 B
TypeScript
18 lines
508 B
TypeScript
import { bench, describe } from 'vitest';
|
|
import { countBy as countByToolkit } from 'es-toolkit';
|
|
import { countBy as countByLodash } from 'lodash';
|
|
|
|
describe('countBy', () => {
|
|
bench('es-toolkit/countBy', () => {
|
|
countByToolkit([1.2, 2.4, 3.6, 2.2, 3.4, 3.6], (item: number) => {
|
|
return Math.floor(item).toString();
|
|
});
|
|
});
|
|
|
|
bench('lodash/countBy', () => {
|
|
countByLodash([1.2, 2.4, 3.6, 2.2, 3.4, 3.6], (item: number) => {
|
|
return Math.floor(item).toString();
|
|
});
|
|
});
|
|
});
|