A destruct() Flush Turns Thousands of Redundant Saves Into Hundreds
Batching operations that trigger an same event subscriber can cause performance problems if that subscriber runs expensive operations. Here's how that happened, and the small change that fixed it without slowing the events down at all: accumulate the work as it comes in, and do it once at shutdown.