Since i don't know if "dotnet run" does optimize code, you may got a point 
there. changed the code to return a string from the function and use 
Task<string>. 
Result:
dotnet run 1000000
Project dotnet (.NETCoreApp,Version=v1.0) was previously compiled. Skipping 
compilation.
Task to execute: 1000000
Task 961 done!
1000000 in 00:00:01.1604266

Still much faster than go!

On Sunday, October 9, 2016 at 10:53:54 AM UTC+3, ohir wrote:
>
> Dnia 2016-10-08, o godz. 23:55:08 
> Sotirios Mantziaris <smant...@gmail.com <javascript:>> napisaƂ(a): 
>
> > Please review my code for any mistakes i made and let me know. 
>
> >        private static void Work(int i){ 
> >            var t = string.Format("Task {0} done!", i); 
> >        } 
>
> Above construct is a NOOP and almost certainly did not went to executable. 
>   
> Probaly even your 'for (int i = 0; i < tasks.Length; i++)' block had been 
> optimized away, as there is no work to do as seen by compiler. 
>
> So in .net version you measure only the tasks array allocation/init time: 
>
> > var sw = Stopwatch.StartNew(); 
> > var tasks = new Task[taskCount]; 
> > sw.Stop(); 
>
> In an era of multicore and aggresive optimizers microbenchmarking is moot. 
>
> -- 
> Wojciech S. Czarnecki 
>        ^oo^ OHIR-RIPE 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to