Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbundyra committed Aug 25, 2020
2 parents 009dcbe + bdbb5d4 commit 82f8d12
Show file tree
Hide file tree
Showing 48 changed files with 598 additions and 453 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/doc/ export-ignore
/Makefile export-ignore
/mkdocs.yml export-ignore
/phpbench.json export-ignore
/phpcs.xml export-ignore
/phpunit.xml.dist export-ignore
/test/ export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.phpunit.result.cache
/clover.xml
/composer.lock
/coveralls-upload.json
Expand Down
28 changes: 13 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,31 @@ env:
matrix:
fast_finish: true
include:
- php: 5.6
- php: 7.3
env:
- DEPS=lowest
- php: 5.6
env:
- DEPS=latest
- TEST_COVERAGE=true
- php: 7
env:
- DEPS=lowest
- php: 7
- php: 7.3
env:
- DEPS=latest
- CS_CHECK=true
- php: 7.1
- TEST_COVERAGE=true
- BENCHMARKS=true
- php: 7.4
env:
- DEPS=lowest
- php: 7.1
- php: 7.4
env:
- DEPS=latest
- TEST_COVERAGE=true
- BENCHMARKS=true
- php: 7.2
- php: nightly
env:
- DEPS=lowest
- php: 7.2
- COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
- php: nightly
env:
- DEPS=latest
- COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
allow_failures:
- php: nightly

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || true ; fi
Expand All @@ -54,6 +51,7 @@ install:

script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
- if [[ $BENCHMARKS == 'true' ]]; then vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi

after_script:
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 3.3.0 - TBD

### Added

- [#10](https://github.com/laminas/laminas-eventmanager/pull/10) adds support for the upcoming PHP 8.0 release.

- [zendframework/zend-eventmanager#72](https://github.com/zendframework/zend-eventmanager/pull/72) adds support for PHP 7.3.

### Changed

- Nothing.

### Deprecated

- Nothing.

### Removed

- [#10](https://github.com/laminas/laminas-eventmanager/pull/10) removes support for PHP versions prior to PHP 7.3.

### Fixed

- Nothing.

## 3.2.2 - TBD

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ documentation](https://docs.laminas.dev/laminas-eventmanager/migration/intro/).
## Benchmarks

We provide scripts for benchmarking laminas-eventmanager using the
[Athletic](https://github.com/polyfractal/athletic) framework; these can be
[PHPBench](https://github.com/phpbench/phpbench) framework; these can be
found in the `benchmarks/` directory.

To execute the benchmarks you can run the following command:

```bash
$ vendor/bin/athletic -p benchmarks
$ vendor/bin/phpbench run --report=aggregate
```
3 changes: 2 additions & 1 deletion benchmarks/TraitEventBench.php → benchmarks/BenchTrait.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

namespace LaminasBench\EventManager;

trait TraitEventBench
trait BenchTrait
{
private $numListeners = 50;

Expand Down
44 changes: 0 additions & 44 deletions benchmarks/MultipleEventIndividualSharedListener.php

This file was deleted.

48 changes: 48 additions & 0 deletions benchmarks/MultipleEventIndividualSharedListenerBench.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace LaminasBench\EventManager;

use Laminas\EventManager\EventManager;
use Laminas\EventManager\SharedEventManager;
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;

use function array_filter;

/**
* @Revs(1000)
* @Iterations(10)
* @Warmup(2)
*/
class MultipleEventIndividualSharedListenerBench
{
use BenchTrait;

/** @var EventManager */
private $events;

/** @var array */
private $eventsToTrigger;

public function __construct()
{
$identifiers = $this->getIdentifierList();
$sharedEvents = new SharedEventManager();
foreach ($this->getEventList() as $event) {
$sharedEvents->attach($identifiers[0], $event, $this->generateCallback());
}
$this->events = new EventManager($sharedEvents, [$identifiers[0]]);

$this->eventsToTrigger = array_filter($this->getEventList(), function ($value) {
return ($value !== '*');
});
}

public function benchTrigger()
{
foreach ($this->eventsToTrigger as $event) {
$this->events->trigger($event);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,29 @@

namespace LaminasBench\EventManager;

use Athletic\AthleticEvent;
use Laminas\EventManager\EventManager;
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;

class MultipleEventLocalListener extends AthleticEvent
use function array_filter;

/**
* @Revs(1000)
* @Iterations(10)
* @Warmup(2)
*/
class MultipleEventLocalListenerBench
{
use TraitEventBench;
use BenchTrait;

/** @var EventManager */
private $events;

/** @var array */
private $eventsToTrigger;

public function setUp()
public function __construct()
{
$this->events = new EventManager();

Expand All @@ -20,12 +33,7 @@ public function setUp()
});
}

/**
* Attach and trigger the event list
*
* @iterations 5000
*/
public function trigger()
public function benchTrigger()
{
foreach ($this->eventsToTrigger as $event) {
$this->events->attach($event, $this->generateCallback());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,46 @@

namespace LaminasBench\EventManager;

use Athletic\AthleticEvent;
use Laminas\EventManager\EventManager;
use Laminas\EventManager\SharedEventManager;

class MultipleEventMultipleLocalAndSharedListener extends AthleticEvent
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;

use function array_filter;

/**
* @Revs(1000)
* @Iterations(10)
* @Warmup(2)
*/
class MultipleEventMultipleLocalAndSharedListenerBench
{
use TraitEventBench;

private $sharedEvents;
use BenchTrait;

/** @var EventManager */
private $events;

/** @var array */
private $eventsToTrigger;

public function setUp()
public function __construct()
{
$identifiers = $this->getIdentifierList();
$this->sharedEvents = new SharedEventManager();
$sharedEvents = new SharedEventManager();
foreach ($this->getIdentifierList() as $identifier) {
foreach ($this->getEventList() as $event) {
$this->sharedEvents->attach($identifier, $event, $this->generateCallback());
$sharedEvents->attach($identifier, $event, $this->generateCallback());
}
}
$this->events = new EventManager($this->sharedEvents, $identifiers);
$this->events = new EventManager($sharedEvents, $identifiers);

$this->eventsToTrigger = array_filter($this->getEventList(), function ($value) {
return ($value !== '*');
});
}

/**
* Attach and trigger the event list
*
* @iterations 5000
*/
public function trigger()
public function benchTrigger()
{
foreach ($this->eventsToTrigger as $event) {
for ($i = 0; $i < $this->numListeners; $i += 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,46 @@

namespace LaminasBench\EventManager;

use Athletic\AthleticEvent;
use Laminas\EventManager\EventManager;
use Laminas\EventManager\SharedEventManager;

class MultipleEventMultipleSharedListener extends AthleticEvent
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;

use function array_filter;

/**
* @Revs(1000)
* @Iterations(10)
* @Warmup(2)
*/
class MultipleEventMultipleSharedListenerBench
{
use TraitEventBench;

private $sharedEvents;
use BenchTrait;

/** @var EventManager */
private $events;

/** @var array */
private $eventsToTrigger;

public function setUp()
public function __construct()
{
$identifiers = $this->getIdentifierList();
$this->sharedEvents = new SharedEventManager();
$sharedEvents = new SharedEventManager();
foreach ($this->getIdentifierList() as $identifier) {
foreach ($this->getEventList() as $event) {
$this->sharedEvents->attach($identifier, $event, $this->generateCallback());
$sharedEvents->attach($identifier, $event, $this->generateCallback());
}
}
$this->events = new EventManager($this->sharedEvents, $identifiers);
$this->events = new EventManager($sharedEvents, $identifiers);

$this->eventsToTrigger = array_filter($this->getEventList(), function ($value) {
return ($value !== '*');
});
}

/**
* Trigger the event list
*
* @iterations 5000
*/
public function trigger()
public function benchTrigger()
{
foreach ($this->eventsToTrigger as $event) {
$this->events->trigger($event);
Expand Down
Loading

0 comments on commit 82f8d12

Please sign in to comment.