tag:blogger.com,1999:blog-7563089691408821967.post8561003209023634794..comments2023-10-24T01:59:01.993+08:00Comments on Another Paradigm Shift: Delegate.BeginInvoke vs ThreadPool.QueueUserWorkItemZhou Yonghttp://www.blogger.com/profile/14116780818653691348noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-7563089691408821967.post-53351535824806797622013-05-22T19:41:00.988+08:002013-05-22T19:41:00.988+08:00Geez! That's 6.4 times faster... I'd bette...Geez! That's 6.4 times faster... I'd better start using threadpooling. Thanks for the advise very useful A+++! Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7563089691408821967.post-23136390962332368912008-09-05T00:59:00.000+08:002008-09-05T00:59:00.000+08:00Great post. Thanks for actually profiling instead ...Great post. Thanks for actually profiling instead of solely using rhetorical devices, intuition, rules of thumb, hearsay, etc, to argue performance points, as is extremely popular on Internet forums related to programming.<BR/><BR/>I profiled QueueUserWorkItem vs. UnsafeQueueUserWorkItem and here are numbers:<BR/><BR/>ThreadPool.QueueUserWorkItem(): 45881667<BR/>ThreadPool.UnsafeQueueUserWorkItem(): 28368351<BR/><BR/>ThreadPool.QueueUserWorkItem(): 55213866<BR/>ThreadPool.UnsafeQueueUserWorkItem(): 31720158<BR/><BR/>ThreadPool.QueueUserWorkItem(): 47258991<BR/>ThreadPool.UnsafeQueueUserWorkItem(): 29558070<BR/><BR/>ThreadPool.QueueUserWorkItem(): 50587812<BR/>ThreadPool.UnsafeQueueUserWorkItem(): 29996415<BR/><BR/>ThreadPool.QueueUserWorkItem(): 57517047<BR/>ThreadPool.UnsafeQueueUserWorkItem(): 26509005<BR/><BR/>UnsafeQueueUserWorkItem is approximately twice as fast as QueueUserWorkItem, at a cost of call stack security.Anonymousnoreply@blogger.com