File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,12 @@ This is the Socket SDK for JavaScript/TypeScript, providing programmatic access
245245- ** Array destructuring** : Use object notation for tuple access when appropriate
246246 - ✅ CORRECT: ` { 0: key, 1: data } `
247247 - ❌ AVOID: ` [key, data] `
248+ - ** Array destructuring performance** : For ` Object.entries() ` loops, use object destructuring for better V8 performance
249+ - ❌ SLOWER: ` for (const [key, value] of Object.entries(obj)) `
250+ - ✅ FASTER: ` for (const { 0: key, 1: value } of Object.entries(obj)) `
251+ - ** Rationale** : Array destructuring requires iterator protocol (per ECMAScript spec), while object destructuring directly accesses indexed properties
252+ - ** Reference** : https://stackoverflow.com/a/66321410 (V8 developer explanation)
253+ - ** Trade-off** : This is a microbenchmark optimization - prioritize readability unless profiling shows this is a bottleneck
248254- ** Array checks** : Use ` !array.length ` instead of ` array.length === 0 `
249255- ** Destructuring** : Sort properties alphabetically in const declarations
250256
You can’t perform that action at this time.
0 commit comments