-
-
Notifications
You must be signed in to change notification settings - Fork 960
Closed
Labels
Description
This class gets called a lot. I already speed up things by ~20% by avoiding the resourceNameCollectionFactory->create() call (quick & dirty):
public function isResourceClass(string $type): bool
{
if (isset($this->arrayCache[$type])) {
return $this->arrayCache[$type];
}
foreach ($this->resourceNameCollectionFactory->create() as $resourceClass) {
$this->arrayCache[$resourceClass] = true;
if ($type === $resourceClass) {
return true;
}
}
$this->arrayCache[$type] = false;
return false;
}
Though, getResourceClass is still slow \o/. I'm not sure that we can find any key to cache our $value though.
I think that by removing try/catch we could improve it a bit, but this would break a lot of things (returning null instead of throwing an InvalidArgumentException). WDYT?
Any ideas appreciated!
Reactions are currently unavailable