testfx icon indicating copy to clipboard operation
testfx copied to clipboard

use `ValueTask` instead of `Task` if possible

Open MarcoRossignoli opened this issue 1 year ago • 2 comments

For compat reason we're returning from the API Tasks we could have some performance benefit (expecially for the IMessageBus IDataConsumer) if we move it to ValueTask.

MarcoRossignoli avatar Aug 05 '24 13:08 MarcoRossignoli

Are you thinking of multi-tfm code or dropping netstandard 2.0?

Evangelink avatar Aug 14 '24 12:08 Evangelink

Are you thinking of multi-tfm code or dropping netstandard 2.0?

We won't never drop netstandard2.0 so or we take a dep there with ValueTask from official package(https://www.nuget.org/packages/System.Threading.Tasks.Extensions/) or #ifdef.

MarcoRossignoli avatar Aug 14 '24 18:08 MarcoRossignoli

How common it is that APIs in question will complete synchronously? Do we have that data?

Youssef1313 avatar Jan 05 '25 14:01 Youssef1313

How common it is that APIs in question will complete synchronously? Do we have that data?

We don't have info about it, also it's not easy, vast majority of time code run sync but depends on the machine load, CI are not big machines and usually busy so the decision to provide async everywhere. For the APIs in question we meant all extensions interfaces.

MarcoRossignoli avatar Jan 07 '25 08:01 MarcoRossignoli

Discussed offline with @MarcoRossignoli about this and it seems that the perf gain would be limited and it's not something where we have issues as of today so adding complexity on extension users seems useless.

Closing as won't fix.

Evangelink avatar Jul 01 '25 07:07 Evangelink