Skip to content

Commit

Permalink
Chore
Browse files Browse the repository at this point in the history
  • Loading branch information
KennedyTedesco committed Dec 16, 2024
1 parent fc16bc8 commit 13700ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
17 changes: 1 addition & 16 deletions src/Monkey/Command/RunFileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,8 @@ public function execute(Configuration $config): int
);
}

$parserPerformanceMetrics = null;
$parserPerformanceTracker = null;

if ($config->hasStats()) {
$parserPerformanceTracker = new PerformanceTracker('Parser');
$parserPerformanceTracker->start();
}

$program = new ProgramParser()($parser);

if ($config->hasStats()) {
$parserPerformanceMetrics = $parserPerformanceTracker->stop();
}

$evaluatorPerformanceMetrics = null;
$evaluatorPerformanceTracker = null;

if ($config->hasStats()) {
Expand All @@ -72,8 +59,7 @@ public function execute(Configuration $config): int
}

try {
$evaluator = new Evaluator();
$result = $evaluator->eval($program, new Environment());
$result = new Evaluator()->eval($program, new Environment());

if ($config->hasStats()) {
$evaluatorPerformanceMetrics = $evaluatorPerformanceTracker->stop();
Expand All @@ -84,7 +70,6 @@ public function execute(Configuration $config): int
$this->outputFormatter->write('');

if ($config->hasStats()) {
$this->outputFormatter->writePerformanceStats($parserPerformanceMetrics);
$this->outputFormatter->writePerformanceStats($evaluatorPerformanceMetrics);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Monkey/IO/OutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function write(string $message): void

public function writePerformanceStats(PerformanceMetrics $metrics): void
{
$this->output->writeln("<title>{$metrics->title} Performance Statistics</title>");
$this->output->writeln("<title>{$metrics->title} Performance</title>");
$table = new Table($this->output);

$table->setRows([
Expand Down

0 comments on commit 13700ce

Please sign in to comment.