Yevadu Posted April 24, 2014 Report Posted April 24, 2014 Hi guys, like to share a small tip which most of u might know. The below code took me 16 seconds to execute. I am using 2.8-Ghz dual core 64 bit processor with 4 GB of RAM. for (int i = 2; i < 20; i++) { var result = SumRootN(i); Console.WriteLine("root {0} : {1} ", i, result); } Instead of a regular for loop I used Parallel.For method and now the execution time got decreased from 16 to 5 seconds Parallel.For(2, 20, (i) => { var result = SumRootN(i); Console.WriteLine("root {0} : {1} ", i, result); }); To view the complete functionality please visit my blog http://vsaditya.blogspot.com/2014/04/parallel-programming.html
Suhaas Posted April 24, 2014 Report Posted April 24, 2014 Framework 4.0 ninchi start ayindi kada ee Parallel class. anthakamundhu lekuknde. 1
puli_keka Posted April 24, 2014 Report Posted April 24, 2014 gp .net starting lo simple gaa undedhi.. events, delegates, parallel prog. hard ga unnayi.. but important concepts hmmm 1
Novak_Djokovic Posted April 24, 2014 Report Posted April 24, 2014 ....GP.... Keep posting new stuff... 1
Yevadu Posted April 24, 2014 Author Report Posted April 24, 2014 I am not sure if Java has this but u can achieve the above by using threads in Java
Recommended Posts