First of all, I'd like to commend the team for the excellent work on MediatR. It's more than just a library, it's a well-defined pattern that has significantly improved the structure and maintainability of the projects.
However, I have encountered a performance issue when using MediatR in projects with a strong dependency on it. Specifically, when handling synchronous operations, we are required to return a Task, which introduces unnecessary garbage collection overhead and negatively impacts performance.
To mitigate this, would it be possible for MediatR to support ValueTask in addition to Task? This change could significantly enhance performance for synchronous operations by reducing the overhead associated with task allocation and garbage collection.
Thank you for considering this enhancement. Your work on MediatR is highly appreciated !
Hi there!
First of all, I'd like to commend the team for the excellent work on MediatR. It's more than just a library, it's a well-defined pattern that has significantly improved the structure and maintainability of the projects.
However, I have encountered a performance issue when using MediatR in projects with a strong dependency on it. Specifically, when handling synchronous operations, we are required to return a
Task
, which introduces unnecessary garbage collection overhead and negatively impacts performance.To mitigate this, would it be possible for MediatR to support
ValueTask
in addition toTask
? This change could significantly enhance performance for synchronous operations by reducing the overhead associated with task allocation and garbage collection.Thank you for considering this enhancement. Your work on MediatR is highly appreciated !