jbogard / MediatR

Simple, unambitious mediator implementation in .NET
Apache License 2.0
10.91k stars 1.16k forks source link

Optimize RequestHandlerWrapperImpl object construction in Mediator's Send Methods #966

Closed pauldin91 closed 5 months ago

pauldin91 commented 9 months ago

Remove activator usage from Send methods, and use new and compiled expression for constructing RequestHandlerWrapperImpl objects

jbogard commented 9 months ago

^^ "Whoops" 🤣

github-actions[bot] commented 8 months ago

This PR is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 14 days.

pijio commented 8 months ago

@jbogard Are you planning to merge this pull request?

github-actions[bot] commented 7 months ago

This PR is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 14 days.

jbogard commented 6 months ago

Is this any faster than Activator.CreateInstance? It's only used once and cached.

pauldin91 commented 6 months ago

Hello @jbogard . No, activator is a still faster than non-cached compiled expressions. To cache the compiled expression, the request type must be known at compile time which in the current situation cannot happen. The only thing that is faster than cached activator is the non-cached direct construction with new. I will revert the changes and commit only the construction with new.

github-actions[bot] commented 5 months ago

This PR is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] commented 5 months ago

This PR was closed because it has been stalled for 14 days with no activity.