Slow aliases and factory set methods #112
Description
In new SM3 there is couple of methods that are more slowly than in SM2
Difference in time is great (about 8x slower on this method)
All other comparisons I provide exactly on that function.
The reason is that is it a lot of factories and aliases that pass to SM with functions setAlias
and setFactory
. Behind the scene one key value pair meld with config in configure
method.
I see 2 ways to solve problem:
- add functions such as
setAliases
and etc...
public function setAliases($aliasTargetPairs)
{
$this->configure(['aliases' => $aliasTargetPairs]);
}
- Modify function
setAlias
to something like that: it was a bad idea, skip that
public function setAlias($alias, $target)
{
$this->validateOverrides(['aliases' => [$alias => $target]]);
$this->aliases[$alias] = $target;
}
First one is more elegant and have maximum speed(10x faster then in SM2, 75x faster current SM3). But we need to rewrite other components.
Second one is twice slower than SM2, but there is no need to modify other components.
Of course we could apply both of them.
I think that first one is best idea, I would like to provide PR for this issue, if it is resonable.
Also I could provide PR to to 2.7 branch of SM witch allows modify other components to use that methods.