Conversation
himself65
left a comment
There was a problem hiding this comment.
not going to make this ready, looks like some parts of change is unnecessary
| const sourceSignalWeakRefs = ArrayFrom(signal[kSourceSignals]); | ||
| for (let i = 0; i < sourceSignalWeakRefs.length; i++) { | ||
| const sourceSignalWeakRef = sourceSignalWeakRefs[i]; |
There was a problem hiding this comment.
That's almost certainly less efficient, ArrayFrom iterate over the object, so we essentially double the number of iteration
There was a problem hiding this comment.
the loop should be converted to a callback, the second argument of ArrayFrom
There was a problem hiding this comment.
I would just leave the for..of here tbh, but in any case, it should be a separate PR
| const encodings = [[kKeyEncodingPKCS1, 'pkcs1'], [kKeyEncodingPKCS8, 'pkcs8'], | ||
| [kKeyEncodingSPKI, 'spki'], [kKeyEncodingSEC1, 'sec1']]; | ||
| for (let i = 0; i < encodings.length; i++) { | ||
| const m = encodings[i]; | ||
| encodingNames[m[0]] = m[1]; | ||
| } |
There was a problem hiding this comment.
I would try to remove that loop entirely at this point
| const encodings = [[kKeyEncodingPKCS1, 'pkcs1'], [kKeyEncodingPKCS8, 'pkcs8'], | |
| [kKeyEncodingSPKI, 'spki'], [kKeyEncodingSEC1, 'sec1']]; | |
| for (let i = 0; i < encodings.length; i++) { | |
| const m = encodings[i]; | |
| encodingNames[m[0]] = m[1]; | |
| } | |
| encodingNames[kKeyEncodingPKCS1] = 'pkcs1'; | |
| encodingNames[kKeyEncodingPKCS8] = 'pkcs8'; | |
| encodingNames[kKeyEncodingSPKI] = 'spki'; | |
| encodingNames[kKeyEncodingSEC1] = 'sec1'; |
There was a problem hiding this comment.
yeah, make sense. we could move to a separate PR
| let entry; | ||
| while ((entry = await dir.read()) !== null) { | ||
| const { name } = entry; |
There was a problem hiding this comment.
This would need to be evaluated separately
aduh95
left a comment
There was a problem hiding this comment.
If you make this PR focused on array iteration (i.e. if you remove all the ArrayFrom calls and leave other non-array iteration for a separate PR), it'd be much easier to review and approve.
I'm +1 on the idea, it also aligns with our recommendation in
node/doc/contributing/primordials.md
Lines 152 to 215 in 9239373
Inspired from #59278