Skip to content

Conversation

@petrroll
Copy link
Contributor

@petrroll petrroll commented Sep 8, 2016

Removed bunch of unnecessary async/await (*1) and added .ConfigureAwait(false) to all remaining awaits because we don't want to be capturing context :).

(1*): There's no point in awaiting a Task<..> when it's result is immediately (without any alteration) returned because you can just as well return the Task<..> itself.

While these two approaches produce different IL (awaiting and immediately returning the result results in a state machine being created and whole bunch of other stuff) the signature of the method (that either returns or awaits the return) remains the same either way which means this is a non-breaking change.

//StackOverflow backing me up: http://stackoverflow.com/questions/19098143/what-is-the-purpose-of-return-await-in-c

(It's highly likely that JIT actually optimizes the await before return away but why have it there if it's completely unnecessary).

@JohnnyCrazy
Copy link
Owner

Looks good, thanks again! 👍

@JohnnyCrazy JohnnyCrazy merged commit 3c82b03 into JohnnyCrazy:master Sep 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants