C# misc note-taking
========================Reactive Extensions=====================
- reactive extensions
- Rx = Observables + LINQ + Schedulers..
========================Digest=====================
MultiThread
Entity Framework
=============== Parallel LINQ from "C# in Depth" chap 12 ================Mandelbrot generator time with different Linq implementation
0 SingleThreadedGenerator 5697 ms - Good Pic
var query = from row in Enumerable.Range(0, Height)
from column in Enumerable.Range(0, Width)
select ComputeIndex(row, column);
1 UnorderedRowsParallelGenerator 1410 ms - bad Pic
var query = from row in Enumerable.Range(0, Height).AsParallel()
from column in Enumerable.Range(0, Width)
select ComputeIndex(row, column);
2 OrderedRowsParallelGenerator 1452 ms - Good Pic
var query = from row in Enumerable.Range(0, Height)
.AsParallel()
.AsOrdered()
from column in Enumerable.Range(0, Width)
select ComputeIndex(row, column);
3. OrderedParallelRangeGenerator 2130 ms - Good Pic
var query = from row in ParallelEnumerable.Range(0, Height).AsOrdered()
from column in Enumerable.Range(0, Width)
select ComputeIndex(row, column);
4. OrderedPixelsParallelGenerator 1522 ms - Good Pic
var pixels = from row in Enumerable.Range(0, Height)
from column in Enumerable.Range(0, Width)
select new { row, column };
var query = from pixel in pixels.AsParallel().AsOrdered()
select ComputeIndex(pixel.row, pixel.column);
5. UnorderedParallelRangeGenerator 2064 ms - Good Pic
var query = from row in ParallelEnumerable.Range(0, Height)
from column in Enumerable.Range(0, Width)
select ComputeIndex(row, column)
6. UnorderedPixelsParallelGenerator 1620 ms- bad Pic
var pixels = from row in Enumerable.Range(0, Height)
from column in Enumerable.Range(0, Width)
select new { row, column };
var query = from pixel in pixels.AsParallel()
select ComputeIndex(pixel.row, pixel.column);
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home