es-toolkit/benchmarks/performance/rest.bench.ts
D-Sketon 71a710b762
feat(rest): implement rest (#374)
* feat(rest): implement rest

* fix: compat
2024-08-15 21:01:13 +09:00

25 lines
630 B
TypeScript

import { bench, describe } from 'vitest';
import { rest as restToolkit } from 'es-toolkit';
import { rest as restCompat } from 'es-toolkit/compat';
import { rest as restLodash } from 'lodash';
describe('rest', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function fn(_a: unknown, _b: unknown, _c: unknown) {
// eslint-disable-next-line prefer-rest-params
return Array.from(arguments);
}
bench('es-toolkit/rest', () => {
restToolkit(fn, 1);
});
bench('es-toolkit/compat/rest', () => {
restCompat(fn, 1);
});
bench('lodash/rest', () => {
restLodash(fn, 1);
});
});