Description
I believe there is a problem with implementation of org.springframework.modulith.events.core.DefaultEventPublicationRegistry.PublicationsInProgress.getPublication
As soon as listeners cannot keep up with event processing, it creates runaway performance issue.
Because the more publications are in progress the more time it spends on searching a TargetEventPublication, slowing down subsequent events.
Example processing speed, application was restarted around 9:30 and as more events were created the performance quickly plummeted
Hot spot when profiling application (other hot spots are also on getPublication but with different code paths):
Event is a simple Record with 2 fields, id and timestamp
Maybe there should be a Set/Map of events so the search is always O(1)?
I saw that 1.4 removed equals but the problem will still be the same because of current search algorithm complexity.