Skip to content

Commit

Permalink
perf: prevent iterating through typed array if using SharedArrayBuffer (
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Jul 17, 2020
1 parent e9228a2 commit e43b493
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export function getTransferList(object, recursive = true, transfers) {
} else if (isTransferable(object.buffer)) {
// Typed array
transfersSet.add(object.buffer);
} else if (ArrayBuffer.isView(object)) {
// object is a TypeArray viewing into a SharedArrayBuffer (not transferable)
// Do not iterate through the content in this case
} else if (recursive && typeof object === 'object') {
for (const key in object) {
// Avoid perf hit - only go one level deep
Expand Down

0 comments on commit e43b493

Please sign in to comment.