Skip to content

Commit

Permalink
Add a new PhelBench test
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Mar 18, 2022
1 parent a5ab5b7 commit 9ed4c9e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/php/Benchmark/Phel/PhelBench.php
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace PhelTest\Benchmark\Phel;

use Phel\Build\BuildFacade;
use Phel\Compiler\Analyzer\Environment\GlobalEnvironmentSingleton;
use Phel\Lang\Symbol;
use Phel\Phel;

/**
* @BeforeMethods("setUp")
* @Revs(5)
* @Iterations(2)
*/
final class PhelBench
{
public function setUp(): void
{
Symbol::resetGen();
GlobalEnvironmentSingleton::initializeNew();

(new BuildFacade())->compileFile(
__DIR__ . '/../../../../src/phel/core.phel',
tempnam(sys_get_temp_dir(), 'phel-core')
);
}

public function bench_phel_run(): void
{
Phel::run(__DIR__ . '/../../../../', 'phel\\core');
}
}

0 comments on commit 9ed4c9e

Please sign in to comment.