tooraj_azizi_1035
شنبه 27 خرداد 1391, 15:23 عصر
سلام
امکانات جدید در برنامه نویسی موازی در NET Framework 4.5.:
Performance بهتر: 400% اجرای سریعتر!
Task Parallel Library
using System;
using System.Diagnostics;
using System.Threading.Tasks;
class Program
{
static void Main()
{
var sw = new Stopwatch();
while (true)
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
var tcs = new TaskCompletionSource<object>();
var t = tcs.Task;
sw.Restart();
for (int i = 0; i < 1000000; i++)
t = t.ContinueWith(_ => (object)null);
var elapsed = sw.Elapsed;
GC.KeepAlive(tcs);
Console.WriteLine(elapsed);
}
}
}
Parallel LINQ (PLINQ)
بسیاری کوئری ها که در نسخه 4 سریال اجرا می شدند اکنون موازی اجرا می شوند!
ساختمان داده های هماهنگ کننده( Coordination Data Structures)
15% اجرای سریعتر پس از Upgrade به نسخه 4.5!
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
class Program
{
static void Main(string[] args)
{
while (true)
{
var cd = new ConcurrentDictionary<int, int>();
var sw = Stopwatch.StartNew();
cd.TryAdd(42, 0);
for (int i = 1; i < 10000000; i++)
{
cd.TryUpdate(42, i, i – 1);
}
Console.WriteLine(sw.Elapsed);
}
}
}
کنترل بیشتر در پارتیشن بندی منبع داده ها در PLINQ و Parallel.For:
با استفاده از enum جدید EnumerablePartitionerOptions!
Parallel.ForEach(Partitioner.Create(source, EnumerablePartitionerOptions.NoBuffering), item =>
{
// ... process item
});
Parallel Watch
Multi-process Support
Concurrency Visualizer Markers
لینک رو ببینید:
http://blogs.msdn.com/b/pfxteam/archive/2011/09/17/10212961.aspx
امکانات جدید در برنامه نویسی موازی در NET Framework 4.5.:
Performance بهتر: 400% اجرای سریعتر!
Task Parallel Library
using System;
using System.Diagnostics;
using System.Threading.Tasks;
class Program
{
static void Main()
{
var sw = new Stopwatch();
while (true)
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
var tcs = new TaskCompletionSource<object>();
var t = tcs.Task;
sw.Restart();
for (int i = 0; i < 1000000; i++)
t = t.ContinueWith(_ => (object)null);
var elapsed = sw.Elapsed;
GC.KeepAlive(tcs);
Console.WriteLine(elapsed);
}
}
}
Parallel LINQ (PLINQ)
بسیاری کوئری ها که در نسخه 4 سریال اجرا می شدند اکنون موازی اجرا می شوند!
ساختمان داده های هماهنگ کننده( Coordination Data Structures)
15% اجرای سریعتر پس از Upgrade به نسخه 4.5!
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
class Program
{
static void Main(string[] args)
{
while (true)
{
var cd = new ConcurrentDictionary<int, int>();
var sw = Stopwatch.StartNew();
cd.TryAdd(42, 0);
for (int i = 1; i < 10000000; i++)
{
cd.TryUpdate(42, i, i – 1);
}
Console.WriteLine(sw.Elapsed);
}
}
}
کنترل بیشتر در پارتیشن بندی منبع داده ها در PLINQ و Parallel.For:
با استفاده از enum جدید EnumerablePartitionerOptions!
Parallel.ForEach(Partitioner.Create(source, EnumerablePartitionerOptions.NoBuffering), item =>
{
// ... process item
});
Parallel Watch
Multi-process Support
Concurrency Visualizer Markers
لینک رو ببینید:
http://blogs.msdn.com/b/pfxteam/archive/2011/09/17/10212961.aspx