es-toolkit/benchmarks/performance/lowerCase.bench.ts
2024-07-17 11:47:39 +09:00

29 lines
711 B
TypeScript

import { bench, describe } from 'vitest';
import { lowerCase as lowerCaseToolkit } from 'es-toolkit';
import { lowerCase as lowerCaseLodash } from 'lodash';
describe('lowerCase', () => {
describe('short string', () => {
bench('es-toolkit/lowerCase', () => {
const str = 'camelCase';
lowerCaseToolkit(str);
});
bench('lodash/lowerCase', () => {
const str = 'camelCase';
lowerCaseLodash(str);
});
});
describe('long string', () => {
const LONG_STR = 'camelCaseLongString'.repeat(1000);
bench('es-toolkit/lowerCase', () => {
lowerCaseToolkit(LONG_STR);
});
bench('lodash/lowerCase', () => {
lowerCaseLodash(LONG_STR);
});
});
});