Closed thekid closed 6 years ago
Affects the web.frontend.delegates.MarkBased
implementation only.
The MarkBased
implementation was supposed to be faster since no pattern iteration is necessary. For a real-world usecase, this doesn't prove to be true, though:
<?php
use util\profiling\Measurable;
use web\frontend\delegates\{MarkBased, PatternBased};
use web\frontend\unittest\Users;
class Routing extends Measurable {
private $mark, $pattern;
public function __construct($method, $arguments= []) {
parent::__construct($method, $arguments);
$users= new Users();
$this->mark= new MarkBased($users);
$this->pattern= new PatternBased($users);
}
#[@measure]
public function mark() {
return $this->mark->target('get', '/users/1549')[1]['id'];
}
#[@measure]
public function pattern() {
return $this->pattern->target('get', '/users/1549')[1]['id'];
}
}
$ xp -m ../measure/ measure Routing -n 1000000
mark: 1000000 iteration(s), 1.245 seconds, result= "1549"
pattern: 1000000 iteration(s), 1.172 seconds, result= "1549"
preg_match_all(): Compilation failed: two named subpatterns have the same name