After profiling my code, I found a performance issue in this function :
public function addEvent(Event $event): self
{
if (!\in_array($event, $this->events, true)) {
$this->events[] = $event;
}
return $this;
}
Indeed, the performance of _inarray() php function is horrible. Can you provide another function using isset() or even with no verification of duplicates ?
You can see in the Symfony Profiler, 1500ms to load 27 000 events without the check in addEvent() function VS 3100ms...
Hi,
After profiling my code, I found a performance issue in this function :
Indeed, the performance of _inarray() php function is horrible. Can you provide another function using isset() or even with no verification of duplicates ?
You can see in the Symfony Profiler, 1500ms to load 27 000 events without the check in addEvent() function VS 3100ms...
, Thanks,