Two common traps when using Parallel Loops could be summarized as following. * The amount of work done in the loop is not significantly larger than the amount of time spend in synchronizing any shared states. * Amount of work done is less than the cost of delegate or method invocation. Both of the problems … Continue reading Partitioner and Parallel Loops
Tag: Benchmark
Enumerable.Empty Vs Array Initialization Syntax
The following set of code showcases two most commonly used methods to generate an empty array in C#. What would be the output of the above lines of code ? One might be tempted to say both returns True. However, that isn't quite right. The output is as follows. The Enumerable.Empty returns the same empty … Continue reading Enumerable.Empty Vs Array Initialization Syntax
A Closer look at DateTime Operations
There are many ways you could round off a DateTime to the nearest Hour. You could create a new Instance of DateTime, ignoring the current instance's Minute/Seconds parts. You could also use the Add Minute method as seen in the following code. Constructor Vs Add Method But which of the two is more efficient ? … Continue reading A Closer look at DateTime Operations