Redesigning the NServiceBus pipeline yet again: The nerd sniping of Daniel Marbach • Particular Software

Daniel and I 1 have worked on improvements to the NServiceBus pipeline multiple times before: a 10x speed-up in 2017, and another 5x improvement in 2022. We thought we were all done with that.


This is a companion discussion topic for the original entry at https://particular.net/blog//pipeline-prewired-invokers

“DIMs allow interfaces to provide a default implementation that all interface implementations inherit automatically. In this case, Daniel used the default interface method to allow each behavior to create its own invoker.”

You can also further this to static analysis and remove the overhead of the dynamic call :slight_smile:

Yes, that is definitely possible :slightly_smiling_face: The nuance is that the DIM call only happens once when the pipeline is built at startup. Removing it through static analysis would therefore optimize a cold path.

To remove the dynamic dispatch on the per-message path, we would have to generate the final pipeline chain while accounting for feature activation, ordering, replacements, and user configuration. I’m not convinced the additional complexity would buy us much in this particular case, but I might be missing something.