Skip to content

Commit

Permalink
refactor: Minor optimization in Window operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Mar 30, 2021
1 parent 77db2cd commit 1e8de4a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Operation/Window.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ static function (Iterator $iterator) use ($size): Generator {
++$size;
$size *= -1;

/** @psalm-var list<T> $stack */
$stack = [];

foreach ($iterator as $key => $current) {
// @todo Should we use Pack ?
$stack[$key] = $current;

yield $key => $stack = array_slice($stack, $size);
yield $key => $stack = array_slice([...$stack, $current], $size);
}
};
}
Expand Down

0 comments on commit 1e8de4a

Please sign in to comment.