Skip to content

Commit

Permalink
Merge pull request #453 from phel-lang/bugfix/update-gacela-bootstrap…
Browse files Browse the repository at this point in the history
…-in-phel-static-helper

Update gacela bootstrap in phel static helper
  • Loading branch information
Chemaclass committed Mar 19, 2022
2 parents f357343 + 9ed4c9e commit 68f52e1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/php/Phel.php
Expand Up @@ -4,6 +4,7 @@

namespace Phel;

use Gacela\Framework\Config\GacelaConfigBuilder\ConfigBuilder;
use Gacela\Framework\Gacela;
use Phel\Run\RunFacade;

Expand All @@ -15,11 +16,9 @@ final class Phel
public static function run(string $projectRootDir, string $namespace): void
{
Gacela::bootstrap($projectRootDir, [
'config' => [
'type' => 'php',
'path' => 'phel-config.php',
'path_local' => 'phel-config_local.php',
],
'config' => static function (ConfigBuilder $configBuilder): void {
$configBuilder->add('phel-config.php', 'phel-config-local.php');
},
]);

$runFacade = new RunFacade();
Expand Down
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 68f52e1

Please sign in to comment.