Skip to content

Commit

Permalink
bench(cloneDeep): add rfdc (#826)
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Sketon authored Nov 15, 2024
1 parent 32019fa commit d799dc5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion benchmarks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"devDependencies": {
"@types/lodash": "^4",
"@types/lodash-es": "^4"
"@types/lodash-es": "^4",
"rfdc": "^1.4.1"
}
}
13 changes: 13 additions & 0 deletions benchmarks/performance/cloneDeep.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import { bench, describe } from 'vitest';
import { cloneDeep as cloneDeepToolkit_ } from 'es-toolkit';
import { cloneDeep as cloneDeepCompatToolkit_ } from 'es-toolkit/compat';
import { cloneDeep as cloneDeepLodash_ } from 'lodash';
import rfdc_ from 'rfdc';

const cloneDeepToolkit = cloneDeepToolkit_;
const cloneDeepCompatToolkit = cloneDeepCompatToolkit_;
const cloneDeepLodash = cloneDeepLodash_;
const rfdcWithCircle = rfdc_({
circles: true,
});
const rfdc = rfdc_();

const obj = {
number: 29,
Expand Down Expand Up @@ -42,4 +47,12 @@ describe('cloneDeep', () => {
bench('node/structuredClone', () => {
structuredClone(obj);
});

bench('rfdc without circle', () => {
rfdc(obj);
});

bench('rfdc with circle', () => {
rfdcWithCircle(obj);
});
});
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3378,6 +3378,7 @@ __metadata:
esbuild: "npm:0.23.0"
lodash: "npm:^4.17.21"
lodash-es: "npm:^4.17.21"
rfdc: "npm:^1.4.1"
vitest: "npm:^2.1.2"
languageName: unknown
linkType: soft
Expand Down

0 comments on commit d799dc5

Please sign in to comment.