What#39;s the difference between QueueUserWorkItem() and BeginInvoke(), for performing an asynchronous activity with no return types needed(QueueUserWorkItem() 和 BeginInvoke() 之间有什么区别,用于执行不需要返回类型的异步活动)
问题描述
继我的 BeginInvoke()/EndInvoke() 问题之后,Delegate.BeginInvoke() 和使用 QueueUserWorkItem() 异步调用委托之间在性能/其他方面是否存在重大差异?
Following on from my BeginInvoke()/EndInvoke() question, are there major differences in performance/anything else between Delegate.BeginInvoke() and using QueueUserWorkItem() to invoke a delegate asynchronously?
推荐答案
http://blogs.msdn.com/cbrumme/archive/2003/07/14/51495.aspx
说:
一个令人惊讶的事实是,这是还有为什么 Delegate.BeginInvoke/与 EndInvoke 相比,速度太慢了等效技术,例如ThreadPool.QueueUserWorkItem(或UnsafeQueueUserWorkItem 如果你了解安全隐患并且想要真正高效).这BeginInvoke/EndInvoke 的代码路径迅速变成共同的讯息一般处理代码远程路径."
"One surprising fact is that this is also why Delegate.BeginInvoke / EndInvoke are so slow compared to equivalent techniques like ThreadPool.QueueUserWorkItem (or UnsafeQueueUserWorkItem if you understand the security implications and want to be really efficient). The codepath for BeginInvoke / EndInvoke quickly turns into the common Message processing code of the general remoting pathway."
这篇关于QueueUserWorkItem() 和 BeginInvoke() 之间有什么区别,用于执行不需要返回类型的异步活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:QueueUserWorkItem() 和 BeginInvoke() 之间有什么区别,用于执行不需要返回类型的异步活动
基础教程推荐
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
