깊은 복사 lodash.cloneDeep, JSON.stringify, structuredClone 비교 #28
coddingyun
started this conversation in
General
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
실험 코드
chatGPT의 힘을 빌려.. 코드를 짜보았습니다.
결과
객체 key-value 개수가 10 개 일때
JSON.stringify: 0.05ms
structuredClone: 0.562ms
lodash.cloneDeep: 0.218ms
객체 key-value 개수가 100 개 일때
JSON.stringify: 0.103ms
structuredClone: 0.089ms
lodash.cloneDeep: 0.221ms
객체 key-value 개수가 1000 개 일때
JSON.stringify: 0.801ms
structuredClone: 2.539ms
lodash.cloneDeep: 1.192ms
객체 key-value 개수가 10000 개 일때
JSON.stringify: 11.21ms
structuredClone: 3.311ms
lodash.cloneDeep: 3.297ms
객체 key-value 개수가 100000 개 일때
JSON.stringify: 149.61ms
structuredClone: 56.776ms
lodash.cloneDeep: 30.914ms
객체 key-value 개수가 1000000 개 일때
JSON.stringify: 1.907s
structuredClone: 906.006ms
lodash.cloneDeep: 420.001ms
결론
따라서,
Beta Was this translation helpful? Give feedback.
All reactions