纤维在C#中:他们比快迭代器,并已使用的人呢? [英] Fibers in C#: are they faster than iterators, and have people used them?

查看:134
本文介绍了纤维在C#中:他们比快迭代器,并已使用的人呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个关于纤维同事聊天并翻起从2003年本文,使用说明在C#中协同程序的实现光纤API。

So I was chatting with a colleague about fibers and turned up this paper from 2003 that describes a implementation of coroutines in C# using the Fiber API.

收益本文是.NET 1.1,实施,因此早于收益回报率语法出现在.NET 2.0。

The implementation of Yield in this paper was for .NET 1.1, so it predates the yield return syntax that appeared in .NET 2.0.

这肯定看起来,乍一看,这里的实现是可能更快,可以扩展到多个CPU的相当好。

It definitely looks, at first glance, that the implementation here is potentially faster and could scale across multiple CPUs rather well.

有没有人用过吗?

推荐答案

我没用过它,但我有这个问题的兴趣。这里有一个很好的实现协同程序在C#中使用循环调度程序: HTTP :?//www.bluebytesoftware.com/blog/PermaLink.aspx GUID = 71235c5a-3753-4bab-bdb0-334ab439afaf

I haven't used it, but I have an interest in the subject. Here's one nice implementation of coroutines in C# with a round-robin scheduler: http://www.bluebytesoftware.com/blog/PermaLink.aspx?guid=71235c5a-3753-4bab-bdb0-334ab439afaf

顺便说一句,报价维基,纤维实质上描述的是同一概念协同程序。据我所知,最接近C#中的协程(或纤维)的迭代器。其实,他们是非常接近协同程序。 利珀特贴一下几个迭代器捕获。但愿,他们没有代表您需要的目的是严重的问题。

By the way, quoting wikipedia, "fibers describe essentially the same concept as coroutines". As far as I know, the closest thing to a coroutine (or a fiber) in C# are iterators. Actually, they are remarkably close to coroutines. Lippert posted several catches about iterators. Hopefully, none of them represent an serious problem for the purposes you need.

这篇关于纤维在C#中:他们比快迭代器,并已使用的人呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆