mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 20:26:33 +03:00
21 lines
546 B
TypeScript
21 lines
546 B
TypeScript
import { bench, describe } from 'vitest';
|
|
import { initial as initialLodash } from 'lodash';
|
|
import { initial as initialToolkit } from 'es-toolkit';
|
|
|
|
// Helper function to generate a large array
|
|
function generateLargeArray(size) {
|
|
return Array.from({ length: size }, (_, index) => index);
|
|
}
|
|
|
|
describe('initial function performance', () => {
|
|
const largeArray = generateLargeArray(1000000);
|
|
|
|
bench('es-toolkit/initial', () => {
|
|
initialToolkit(largeArray);
|
|
});
|
|
|
|
bench('lodash/initial', () => {
|
|
initialLodash(largeArray);
|
|
});
|
|
});
|