2024-07-18 04:00:59 +03:00
|
|
|
import { describe, bench } from 'vitest';
|
2024-08-11 09:21:14 +03:00
|
|
|
import { set as setToolkitCompat } from 'es-toolkit/compat';
|
2024-07-18 04:00:59 +03:00
|
|
|
import { set as lodashSet } from 'lodash';
|
|
|
|
|
|
|
|
describe('set', () => {
|
|
|
|
bench('es-toolkit/set-1', () => {
|
2024-08-11 09:21:14 +03:00
|
|
|
setToolkitCompat({}, 'a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', 1);
|
2024-07-18 04:00:59 +03:00
|
|
|
});
|
|
|
|
bench('es-toolkit/set-2', () => {
|
2024-08-11 09:21:14 +03:00
|
|
|
setToolkitCompat({}, 'a[0][1][2][3][4][5][6]', 1);
|
2024-07-18 04:00:59 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
bench('lodash/set-1', () => {
|
|
|
|
lodashSet({}, 'a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', 1);
|
|
|
|
});
|
|
|
|
bench('lodash/set-2', () => {
|
|
|
|
lodashSet({}, 'a[0][1][2][3][4][5][6]', 1);
|
|
|
|
});
|
|
|
|
});
|