2024-07-12 04:17:34 +03:00
|
|
|
import { bench, describe } from 'vitest';
|
|
|
|
import { lowerCase as lowerCaseToolkit } from 'es-toolkit';
|
|
|
|
import { lowerCase as lowerCaseLodash } from 'lodash';
|
|
|
|
|
|
|
|
describe('lowerCase', () => {
|
2024-07-14 10:22:19 +03:00
|
|
|
describe('short string', () => {
|
|
|
|
bench('es-toolkit/lowerCase', () => {
|
|
|
|
const str = 'camelCase';
|
|
|
|
lowerCaseToolkit(str);
|
|
|
|
});
|
|
|
|
|
|
|
|
bench('lodash/lowerCase', () => {
|
|
|
|
const str = 'camelCase';
|
|
|
|
lowerCaseLodash(str);
|
|
|
|
});
|
2024-07-12 04:17:34 +03:00
|
|
|
});
|
|
|
|
|
2024-07-14 10:22:19 +03:00
|
|
|
describe('long string', () => {
|
|
|
|
const LONG_STR = 'camelCaseLongString'.repeat(1000);
|
|
|
|
bench('es-toolkit/lowerCase', () => {
|
|
|
|
lowerCaseToolkit(LONG_STR);
|
|
|
|
});
|
|
|
|
|
|
|
|
bench('lodash/lowerCase', () => {
|
|
|
|
lowerCaseLodash(LONG_STR);
|
|
|
|
});
|
2024-07-12 04:17:34 +03:00
|
|
|
});
|
|
|
|
});
|