Is it faster?

2011/12/11

3 comments

Is it faster?

does the .NET 4.5 really run faster than 4?

Tpl, task, await, async, performance

this post will summaries TPL Performance Improvements in .NET 4.5.

the TPL team has put lot of effort to dramatically improve the overall performance of .NET 4.5.

the improvement was achieve both by execution and memory allocation optimization.

in result .NET 4.5 parallelism is faster and more GC friendly.

allocation optimization does improve the overall execution speedup, because GC collection does have significantly impact on the overall performance (thread freezing and more).

the benchmarks in this post were execute against 100000 tasks with 25 iterations.

Continuation:

.NET 4.5 acknowledged the continuation-style of programming to be a mainline scenario (async/await support). lot of effort were put into making continuations faster.

using the magical Interlocked.CompareExchange the continuation footprint were reduce while the task is having single continuation (there will be no continuation list assignment in this case), but even when having more than a single continuation .NET 4.5 is still faster than in .NET 4.

the following benchmark show single continuation assignment:

performance (speedup):

Tpl, task, await, async

memory allocation:

Tpl, task, await, async

the following benchmark show multiple continuation assignment:

performance (speedup):

Tpl, task, await, async

memory allocation:

Tpl, task, await, async

 
Restructuring Task:

the task internal was redesign to have a minimal memory footprint for common scenarios, while also supporting more rare scenarios.

the following benchmark show improvement over Task creation:

performance (speedup):

image

memory allocation:

image

 

the following benchmark show improvement over creation of Task<T>:

performance (speedup):

image

memory allocation:

image

 
TaskCompletionSource

the following benchmark show improvement over creation of TaskCompletionSource:

performance (speedup):

Tpl, task, await, async

memory allocation:

Tpl, task, await, async

 

summary

TPL 4.5 performance was significantly improved both in terms of speedup and allocations.

you can see the full benchmarks information and more details about the inner stuff at TPL Performance Improvements in .Net 4.5 by Joseph E. Hoag.

Shout it kick it on DotNetKicks.com

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

3 comments

  1. my review here2013/12/09 ב 07:48

    I am genuinely delighted to read this web site posts which contains plenty of
    useful data, thanks for providing these kinds of data.

    Reply
  2. Webpage2013/12/16 ב 18:39

    hi!,I really like your writing so much! percentage
    we communicate more about your article on AOL? I need a specialist on this area to
    solve my problem. May be that’s you! Looking forward to peer you.

    Stop by my web page: Webpage

    Reply
  3. webpage2013/12/22 ב 00:55

    Today, I went to the beach front with my kids. I found a sea shell and gave it to my 4 year old daughter and
    said “You can hear the ocean if you put this to your ear.” She put the shell to her ear
    and screamed. There was a hermit crab inside and it pinched
    her ear. She never wants to go back! LoL I know this is completely off topic but I had to tell someone!

    My web site – webpage

    Reply