Rx – Sample

Thursday, January 5, 2012

Rx - Sample this post will focus on the Rx Sample operator. the Sample operation does sampling the observable stream and forward less intensive data stream of the sampled datum. it can be prove very useful for scenario like handling accelerometer stream which can produce 60 value per second, in some cases we don't need such intensity and our machine resources may be happier to handle only 10 value per seconds. the same may be apply to video stream analytics and many other...

the concept of async \ await

Thursday, December 29, 2011

the concept of async \ await in this post I will survey the new .NET 4.5 / C# 5 concept of async / await. I will focus on how to understand what is really happens behind the new async / await syntax. What's it all about? the new async / await syntax is using the C# syntactic compiler to generate async operation from code that is looking very much like a synchronous code. but before we start we should discus the new C# 5  syntax. the syntax include 2 keywords: ...

Tpl Dataflow (IDataflowBlock) – Part 5

Monday, December 19, 2011

Tpl Dataflow (IDataflowBlock ) - Part 5 the previous post discus the concept ITargetBlock and ISourceBlock, which is the TDF consumer/Producer contract. you can find all the post in this series under the TDF tag. this post focus on the IDataflowBlock contract which is the life-time management contract for all data-flow's blocks. the IDataflowBlock define single property and 2 methods: Code Snippet public interface IDataflowBlock {     Task Completion { get; }       void Complete();     void Fault(Exception exception); } ...

Task != Thread

Sunday, December 18, 2011

Task != Thread whenever I teaching the Tpl Task subject I continually repeating the mantra which say that "task is a metadata/context of execution and it does not really responsible for the actual execution". Task is a data structure which hold information about code execution, it's hold the delegate which will be execute, status, state, result, exception synchronization object, ext... but the responsibility of the execution is actually belong to the Task Scheduler. in matter of fact task can be execute synchronously. Code Snippet Console.WriteLine(Thread.CurrentThread.ManagedThreadId); Task...

Is it faster?

Sunday, December 11, 2011

Is it faster? does the .NET 4.5 really run faster than 4? 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...
3 comments

Rx Contrib – new release

Tuesday, August 9, 2011

Rx Contrib - new release   finally I got the time to update the Rx Contrib with the Rx release bits. the release contain couple of new features and refactoring.   This a snapshot of what's in the release: The ReactiveQueue was refactor to QueueSubject. The static Create method overload has changed: now it is having a flags which can define it’s behaviors, a-sync and whether to ...

Enum.HasFlag: good or bad?

Friday, January 28, 2011

Enum.HasFlag: good or bad? .NET 4 give us nice elegant way of checking whether enums contain a value.   assuming that we have the following enum: Code Snippet public enum MyEnum {     None = 0,     A = 1,     B = 2,     C = 4,     D = 8 } we can use the bitwise for checking whether instantiation of the enum contain a value, as shown in the next snippet: Code Snippet var options = MyEnum.A | MyEnum.B;...
no comments

Performance tips

Tuesday, May 4, 2010

Performance tips recently I was working on the Reactive Queue (which is part of the Rx Contrib). the requirement for the Reactive Queue was to to achieve the highest throughput possible for each queue provider (2,000,000 messages of 500 byte per second using Concurrent Queue provider running on simple quad server). while working on this project I was encounter the the following performance hits:   1. ManualResetEventSlim there is a big difference between using the old ManualResetEvent Vs. ManualResetEventSlim the hit factor can go up to 2...