Hi Steve, looks like you're getting rid of the "event object"? No more events to be allocated?
I think that's a great idea, but I wonder about the readability of the code. With "inline types" coming soon to the JDK, the event object types could be great candidates to be converted into inline? If we used the inline types for such things I'm confident that allocation would improve significantly; it's undeniable that not having anything-at-all would be even better - but perhaps it could be a better tradeoff in consideration of maintainability. I also noticed that it's quite possible that some "list of eventlisteners" for a specific event type could be empty: no listeners at all. So an aspect that could be worth exploring while thinking about the event system design, is to avoid creating en event in such cases; there's an example of this approach already in org.hibernate.internal.SessionImpl#internalClear : the signature I had to use is a bit puzzling, but it manages to avoid allocating the event (unless needed) and also avoids allocating the iterator on the listeners. For example PostLoad events by default have a single listener, but looking more closely I believe we could avoid registering that single listener depending on configuration. Thanks, Sanne On Tue, 26 May 2020 at 16:00, Steve Ebersole <st...@hibernate.org> wrote: > > Historically we made a terrible design mistake with the event system as a > whole. This has both a confusing design impact and a very real performance > impact. The main problem is the smashing together of things that handle > events and things that listen to such events. > > In working on a problem in v6 I have come to a point where fixing this > design flaw for load events specifically would be a huge help. So I'm > going to make a proposal for how to specifically change this for load event > handling. The plan at the moment is to not make similar changes to the > other event types for now, though I certainly would like to keep them all > in mind with regard to the overall design for if/when we can get to the > others. > > So I'd love feedback specifically regarding (1) general design considering > other event types and (2) issues/concerns specific to load event type. > > I created a simple example at > https://gist.github.com/sebersole/2a1c3ac010a166fc91e62b088179678d > > Thanks! > _______________________________________________ > hibernate-dev mailing list > hibernate-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/hibernate-dev > _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev