On Friday, 27 July 2012 at 19:12:41 UTC, H. S. Teoh wrote:
I'm pretty sure Yield has a performance hit as well, 'cos it
amounts to an implicit context-switch between two fibers.
Unless I'm sorely mistaken, Yield has bugger-all to do with
fibers. I say again: I'm not talking about threading. There is
more than one meaning of the word "yield". Go look it up. I
provided a link in a previous post.
Of course, from what I understand, C# runs on a VM, correct? If
so, this performance hit is probably hidden in the VM overhead,
since the VM is already keeping track of states anyway, so the
cost of tracking multiple states is absorbed into the VM's
overall
overhead. So you probably won't _notice_ the cost, but it's
definitely
there.
I'm fairly sure D could implement the Iterator and Yield keywords
from VB.NET without all this "overhead" to which you refer. As I
said, go look it up.