-
Notifications
You must be signed in to change notification settings - Fork 17
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
#73 Adds setup for simple benchmarks #80
Conversation
These changes add a simple benchmark setup. This allows us to create and run the benchmark tests.
I started with this small setup. Let me know if there are features that I didn't cover |
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.
For an initial version it looks good, see my remarks for some minor changes. In addition to that I would love to see benchmarks for the different bean configuration options (singleton / non-singleton, lazy / non-lazy, alias) to see which impact the different configuration options have.
Do you have a good idea how to add the benchmarks to the README.md file? Since we have the "production tuning" section there it might be a good idea to include the benchmark results there somehow.
/** | ||
* @Bean | ||
*/ | ||
public function mySimpleService() : A { |
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.
For consistency reasons the method should be named A. You could define "mySimpleService" as alias. That way we could also run a bechmark trying to retrieve beans by the alias.
/** | ||
* @Bean | ||
*/ | ||
public function B() : B { |
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.
Please use the PSR-2 standard for formatting the configuration class.
/** | ||
* @Configuration | ||
*/ | ||
class MyConfiguration |
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.
Better rename the class to BenchmarkConfiguration so that it is clear what the purpose of the class is.
\bitExpert\Disco\BeanFactoryRegistry::register($this->disco); | ||
} | ||
|
||
public function benchCreateInstance() |
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.
For consistency reasons the method should be named benchCreateSimple()
phpbench supports reporting to markdown, so it will be very easy to add those results to the readme. I will have a look at your requested changes and add more benchmarks for other cases. Glad you like the initial setup. |
Fixes number of psr2 issues and clearified some class and method naming for consistency
Report for github can be generated using the command below `vendor/bin/phpbench run --report=aggregate -o github`
|
||
public function benchCreateSimpleAliased() | ||
{ | ||
$this->disco->get('mySimpleService'); |
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.
For some reason this bench will run forever.
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.
Seems to work fine for me. Which PHP version did you use to run the test?
I used php7.0 not sure about the exact version
Op zo 11 dec. 2016 13:43 schreef Stephan Hochdörfer <
notifications@github.com>:
… ***@***.**** commented on this pull request.
------------------------------
In benchmarks/Bench/BaseObjectCreation.php
<#80>:
> +
+use bitExpert\Disco\BeanFactory;
+
+abstract class BaseObjectCreation
+{
+ /** @var BeanFactory */
+ protected $disco;
+
+ public function benchCreateSimple()
+ {
+ $this->disco->get('A');
+ }
+
+ public function benchCreateSimpleAliased()
+ {
+ $this->disco->get('mySimpleService');
Seems to work fine for me. Which PHP version did you use to run the test?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#80>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABAuUXfAf4vhJXrCqaQAh936vVdTFw3qks5rG_AMgaJpZM4LGu4R>
.
|
These changes add a simple benchmark setup.
This allows us to create and run the benchmark tests.
Releated to #73