Hi Jan. The correct analogy here are not threads but Tasks from the 
excellent Task Parallel Library in order to compare Apples with Apples. 

i have a little stupid source code (https://github.com/mantzas/headon) that 
run in parallel n tasks and the equivalent in go.

dotnet run 1000000
Project dotnet (.NETCoreApp,Version=v1.0) was previously compiled. Skipping 
compilation.
Task to execute: 1000000
1000000 in 00:00:00.8903075
 
go.exe -tasks 1000000
Task to execute: 1000000
1000000 in 3.9731993s

when running higher number of tasks like 10000000 i get:

λ dotnet run 10000000
Project dotnet (.NETCoreApp,Version=v1.0) was previously compiled. Skipping 
compilation.
Task to execute: 10000000
10000000 in 00:00:07.9395814

the same in go had the following result:
eating all my memory and crashed

BTW the dotnet memory consumption is around 700 MB. 
When using dotnet's Parallel.For we have even better results

λ dotnet run 10000000
Project dotnet (.NETCoreApp,Version=v1.0) was previously compiled. Skipping 
compilation.
Task to execute: 10000000
10000000 in 00:00:00.8419129

and the memory consumption is around 7MB!!!

i have tested the same in Linux so i could say the following based on the 
above:

dotnet has a better implemented concurrency library allowing only some 
tasks to run concurrently (POOL) and it is by a lot faster than goroutines.

in go you can shoot yourself in the foot easily.

Please review my code for any mistakes i made and let me know.




On Saturday, October 8, 2016 at 10:33:24 AM UTC+3, Jan Mercl wrote:
>
> On Wed, May 18, 2016 at 4:06 PM Sotirios Mantziaris <smant...@gmail.com 
> <javascript:>> wrote:
>
> > The claim that .Net is not heavily concurrent is not true either. 
>
> A Go program executing 100k goroutines needs 200MB or 400MB RAM for stack, 
> depending on version, so it can run just fine. A .net program trying to 
> execute 100k threads will OOM way before reaching a even a small fraction 
> of the goal.
>
> -- 
>
> -j
>

-- 
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