
Benchmarking 1M C# tasks vs. Go goroutines - karl_p
https://medium.com/@karl.pickett/benchmarking-a-toy-c-task-vs-a-go-goroutine-is-there-any-difference-248f73f7f7b7
======
bithavoc
It's true, those are tasks vs goroutines. However, what I'd really love to see
is tasks vs goroutines using the standard library IO operations. I'm sure Go
would be a clear winner.

------
jim_bailie
This is an interesting and informative little benchmark. I'm sure a few things
can be picked apart, but eh.

What am also interested in hearing about is the author's experience with
building a web app with c# on Linux, or anyone else's experience for that
matter. I really didn't know it was ever ported, but I don't get out much.

~~~
karl_p
Hi, author here. Thanks for the kind words!

I ported the static site generator for patternedpom.com (sells handmade cards)
from Python to C# without changing any layout or styling (PS I don't claim to
be a frontend person). It was a code port only. 1000 LOC of C#, and it took me
two weeks.

I am happy with the result code - The classes are immutable (auto properties /
read only collections)[1], LINQ is a very suitable replacement for list
comprehensions, and it's faster than the python.

Razor Templates are very nice - I have an outer layout file and an inner
template for each page. I think they came out very cleanly, and I can do LINQ
inside of them[2]. Obviously you can do similar things with jinja templates,
but razor templates won't compile if something is wrong / doesn't match what
the model exposes (yay for catching bugs early). And you can still pass a
"dynamic" type object if you want python like behavior (that throws an
exception on unknown property).

The "backend" is a google spreadsheet (using their .NET SDK) and some
CommonMark markdown files. So it's not doing anything dynamic (yet, I'm almost
done adding digital purchases using AWS Lambda / PayPal IPN, which would be a
new feature for the site). And it syncs using AWS's S3 .NET SDK.

I don't think it was actually that many more lines of C# compared to python,
in any case it's worth it for me. I am tired of using scripting languages for
things other than, well, scripts. I hope Microsoft doesn't break things on me
in a few years (fingers crossed).

That said... let's look at some other issues.

\- vscode is ok. not perfect, probably some bugs (I get "file not found"
popups from time to time that I have to close), but it's free. At least if you
have the time to learn it. (I'm overwhelmed by all the configuration options
really... and I'm trying to use the vim plugin which probably isn't helping my
cognitive load)

\- minor things: no generic ordereddictionary (casting isn't horrible though),
no inplace collection sort() that takes a simple Key lambda, like the LINQ
OrderBy() that copies.

\- Library ecosystem - this is probably the #1 thing to check out. Does a good
library exist, and does it run on .net core. Compared to Java or python, it's
probably less, but do your own DD in advance. There is not even a standard
command line option parser in .NET Core - so if it's anything you need outside
of the core language, you need to build/buy/find it. It doesn't try to be a
"batteries included" thing.

\- Another example with libraries: I was looking at adding dynamic search with
AWS lambda, but the .net lucene library seems to be an old port of the java
library.

1\.
[https://github.com/kjpgit/ppom/blob/master/source/SiteBuilde...](https://github.com/kjpgit/ppom/blob/master/source/SiteBuilder/StoreData.cs#L12-L33)

2\.
[https://github.com/kjpgit/ppom/blob/master/source/SiteBuilde...](https://github.com/kjpgit/ppom/blob/master/source/SiteBuilder/templates/blog-
archive.cshtml#L6-L22)

~~~
Kipters
FWIW, Mono.Options is a decently widespread solution for command line parsing

