Skip to content

Commit

Permalink
Added forced garbage collector call before each iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-helldar committed Feb 4, 2023
1 parent 12e1f94 commit b22e96e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Services/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
class Runner
{
public function call(callable $callback): float
{
$this->clean();

return $this->run($callback);
}

protected function clean(): void
{
gc_collect_cycles();
}

protected function run(callable $callback): float
{
$startAt = hrtime(true);

Expand Down

0 comments on commit b22e96e

Please sign in to comment.