mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 20:26:33 +03:00
29 lines
724 B
TypeScript
29 lines
724 B
TypeScript
|
import { bench, describe } from 'vitest';
|
||
|
import { upperFirst as upperFirstToolkit } from 'es-toolkit';
|
||
|
import { upperFirst as upperFirstLodash } from 'lodash';
|
||
|
|
||
|
describe('upperFirst', () => {
|
||
|
describe('short string', () => {
|
||
|
bench('es-toolkit/upperFirst', () => {
|
||
|
const str = 'camelCase';
|
||
|
upperFirstToolkit(str);
|
||
|
});
|
||
|
|
||
|
bench('lodash/upperFirst', () => {
|
||
|
const str = 'camelCase';
|
||
|
upperFirstLodash(str);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
describe('long string', () => {
|
||
|
const LONG_STR = 'camelCaseLongString'.repeat(1000);
|
||
|
bench('es-toolkit/upperFirst', () => {
|
||
|
upperFirstToolkit(LONG_STR);
|
||
|
});
|
||
|
|
||
|
bench('lodash/upperFirst', () => {
|
||
|
upperFirstLodash(LONG_STR);
|
||
|
});
|
||
|
});
|
||
|
});
|