This project has moved and is read-only. For the latest updates, please go here.

async and Effort performance

Apr 13, 2015 at 8:12 AM
Normally async should be used for operations that involve external ressources and not in memeory ressources.
So this is true for a normal database.
But since Effort uses an in memory database, does it run faster (or slower) when using async Operations (ToListAsync(), ...) or is there no difference?
Apr 13, 2015 at 1:06 PM
Edited Apr 13, 2015 at 2:11 PM
The main purpose of async in ADO.NET is to avoid having blocking threads, therefore your server application may scale better. Effort uses the inprocess NMemory database under the hood that always blocks the thread during the data operations. The async methods of the Effort provider are merely wrappers of the sync counterparts, therefore you will not have any gain using them.

However, you should design your application against your production environment (real database) and not against the testing environment (Effort). So the fact that Effort doesn't get performance gain from async shouldn't effect your judgement about utilising async methods.
Apr 13, 2015 at 1:43 PM
The application itself is of course designed against the real database and is using async calls.
I was talking about the code in my Tests using Effort.
As Effort is using an in memory database, I think that "ToList()" is faster than "await ToListAsync()" because there is no async overhead.
But I'm not 100% sure, so I thought it would be a good idea, to ask you, the developer :)
Apr 13, 2015 at 2:14 PM
Yes there is an overhead, but it probably negligible compared to all the staff that is happening in EF, Effort and NMemory :)
Apr 13, 2015 at 2:28 PM
I have over 400 Tests using Effort, so even a slight improvement is measurable :)