-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Program executor #948
base: master
Are you sure you want to change the base?
Program executor #948
Conversation
3fd9de2
to
b385644
Compare
/** | ||
* @return array<string,mixed> | ||
*/ | ||
public function execute(/** include the run ID here **/string $script): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea was to include the run ID so that it can be used to namespace the file rather than use a uniqid
. Doesn't help if we support parallel benchmarking in the future (not sure if that's a valid use case though)
$value = $evaluator->evaluateType($node->node(), NumberNode::class, $params); | ||
$value = $evaluator->evaluate($node->node(), $params); | ||
|
||
if ($value instanceof NullNode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
{ | ||
public function create(array $data): ResultInterface | ||
{ | ||
return new TimeResult(($data['net']), $data['revs'], 'nanoseconds'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use TimeUnit constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validate for array key existence
* Return the net-time for this iteration. | ||
*/ | ||
public function getNet(): int | ||
{ | ||
return $this->netTime; | ||
return (int)$this->netTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be fine to change this to a float? in the medium term we need to change the base from microseconds to nanoseconds. not actually sure what uses this method.
be35b89
to
f158ab3
Compare
f158ab3
to
ea4d34b
Compare
|
||
namespace PhpBench\Executor; | ||
|
||
class PhpProcessOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final
$stage = $this->scriptStages[$node->name]; | ||
$lines = $this->indent(array_merge([ | ||
sprintf('// >>> %s', $node->name), | ||
], $stage->start($context)), $indentation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/node/unit
@@ -41,6 +41,10 @@ final class Token | |||
public const T_STRING = 'string'; | |||
public const T_PARAMETER = 'parameter'; | |||
public const T_QUESTION = 'question'; | |||
public const T_SEMICOLON = 'semicolon'; | |||
public const T_OPEN_BRACE = 'open_brace'; | |||
public const T_CLOSE_BRACE = 'close_brace'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove these now?
This PR experiments with adding a new executor which can execute benchmark variants according to "programs".
A program is a nestable sequence of named "code snippets"/units which are used to compose the benchmarking script.
Benefits:
for
loop over the revs, print out the call N times)The default PHPBench executor can be reproduced with:
POC TODO:
TODO:
IDEAS: