perf(세션): store clone 할당을 줄이기 · openclaw/openclaw@99b27cd
steipete
·
2026-05-28
·
via Recent Commits to openclaw:main
| 원본 파일 줄 번호 | 차이 줄 번호 | 차이 줄 변경 |
|---|
@@ -196,10 +196,21 @@ function cloneJsonLikeValue<T>(value: T): T {
|
196 | 196 | return value; |
197 | 197 | } |
198 | 198 | if (Array.isArray(value)) { |
199 | | -return value.map((item) => cloneJsonLikeValue(item)) as T; |
| 199 | +const cloned = new Array(value.length); |
| 200 | +for (let index = 0; index < value.length; index += 1) { |
| 201 | +if (!(index in value)) { |
| 202 | +continue; |
| 203 | +} |
| 204 | +cloned[index] = cloneJsonLikeValue(value[index]); |
| 205 | +} |
| 206 | +return cloned as T; |
200 | 207 | } |
201 | 208 | const cloned: Record<string, unknown> = {}; |
202 | | -for (const [key, child] of Object.entries(value as Record<string, unknown>)) { |
| 209 | +for (const key in value as Record<string, unknown>) { |
| 210 | +if (!Object.prototype.hasOwnProperty.call(value, key)) { |
| 211 | +continue; |
| 212 | +} |
| 213 | +const child = (value as Record<string, unknown>)[key]; |
203 | 214 | if (child === undefined) { |
204 | 215 | continue; |
205 | 216 | } |
|
이 콘텐츠는 인셔셔RSS(RSS 리더)가 자동으로 집계한 것으로 읽기 참고용입니다. 원문 출처 — 저작권은 원저작자에게 있습니다.