S
Sudip_inn
Guest
i have 817376 records in my list.
when i query my list without AsParallel() this way then it is taking 39 ms
Stopwatch swatch = new Stopwatch();
swatch.Start();
var abc = objQcVerticalViewNew.objQcVerticalViewNewProcess.ResultData.Where(a => a.TabName == "Operational Metrics"
&& a.StandardLineItem == "Customer Relationships (EOP) (In 000)" && a.BrokerCode == "SF-C1" && a.StandardDate.Contains("1Q 2014")).ToDataTable();
swatch.Stop();
TimeSpan timeSpan1 = swatch.Elapsed;
MessageBox.Show(string.Format("Time Elapsed {0}h {1}m {2}s {3}ms", timeSpan1.Hours, timeSpan1.Minutes, timeSpan1.Seconds, timeSpan1.Milliseconds));
but when i use AsParallel() to run my code faster then it is taking 50 ms....why?
Stopwatch swatch = new Stopwatch();
swatch.Start();
var abc = objQcVerticalViewNew.objQcVerticalViewNewProcess.ResultData.Where(a => a.TabName == "Operational Metrics"
&& a.StandardLineItem == "Customer Relationships (EOP) (In 000)" && a.BrokerCode == "SF-C1" && a.StandardDate.Contains("1Q 2014")).AsParallel().ToDataTable();
swatch.Stop();
TimeSpan timeSpan1 = swatch.Elapsed;
MessageBox.Show(string.Format("Time Elapsed {0}h {1}m {2}s {3}ms", timeSpan1.Hours, timeSpan1.Minutes, timeSpan1.Seconds, timeSpan1.Milliseconds));
OR
Stopwatch swatch = new Stopwatch();
swatch.Start();
var abc = objQcVerticalViewNew.objQcVerticalViewNewProcess.ResultData.AsParallel().Where(a => a.TabName == "Operational Metrics"
&& a.StandardLineItem == "Customer Relationships (EOP) (In 000)" && a.BrokerCode == "SF-C1" && a.StandardDate.Contains("1Q 2014")).ToDataTable();
swatch.Stop();
TimeSpan timeSpan1 = swatch.Elapsed;
MessageBox.Show(string.Format("Time Elapsed {0}h {1}m {2}s {3}ms", timeSpan1.Hours, timeSpan1.Minutes, timeSpan1.Seconds, timeSpan1.Milliseconds));
both AsParallel() approach taking long time.
where i am making the mistake which increase the time? i heard AsParallel is faster and that is why i used but AsParallel taking more time. so guide me how to use AsParallel() right way. thanks
Continue reading...
when i query my list without AsParallel() this way then it is taking 39 ms
Stopwatch swatch = new Stopwatch();
swatch.Start();
var abc = objQcVerticalViewNew.objQcVerticalViewNewProcess.ResultData.Where(a => a.TabName == "Operational Metrics"
&& a.StandardLineItem == "Customer Relationships (EOP) (In 000)" && a.BrokerCode == "SF-C1" && a.StandardDate.Contains("1Q 2014")).ToDataTable();
swatch.Stop();
TimeSpan timeSpan1 = swatch.Elapsed;
MessageBox.Show(string.Format("Time Elapsed {0}h {1}m {2}s {3}ms", timeSpan1.Hours, timeSpan1.Minutes, timeSpan1.Seconds, timeSpan1.Milliseconds));
but when i use AsParallel() to run my code faster then it is taking 50 ms....why?
Stopwatch swatch = new Stopwatch();
swatch.Start();
var abc = objQcVerticalViewNew.objQcVerticalViewNewProcess.ResultData.Where(a => a.TabName == "Operational Metrics"
&& a.StandardLineItem == "Customer Relationships (EOP) (In 000)" && a.BrokerCode == "SF-C1" && a.StandardDate.Contains("1Q 2014")).AsParallel().ToDataTable();
swatch.Stop();
TimeSpan timeSpan1 = swatch.Elapsed;
MessageBox.Show(string.Format("Time Elapsed {0}h {1}m {2}s {3}ms", timeSpan1.Hours, timeSpan1.Minutes, timeSpan1.Seconds, timeSpan1.Milliseconds));
OR
Stopwatch swatch = new Stopwatch();
swatch.Start();
var abc = objQcVerticalViewNew.objQcVerticalViewNewProcess.ResultData.AsParallel().Where(a => a.TabName == "Operational Metrics"
&& a.StandardLineItem == "Customer Relationships (EOP) (In 000)" && a.BrokerCode == "SF-C1" && a.StandardDate.Contains("1Q 2014")).ToDataTable();
swatch.Stop();
TimeSpan timeSpan1 = swatch.Elapsed;
MessageBox.Show(string.Format("Time Elapsed {0}h {1}m {2}s {3}ms", timeSpan1.Hours, timeSpan1.Minutes, timeSpan1.Seconds, timeSpan1.Milliseconds));
both AsParallel() approach taking long time.
where i am making the mistake which increase the time? i heard AsParallel is faster and that is why i used but AsParallel taking more time. so guide me how to use AsParallel() right way. thanks
Continue reading...