Why C++ instead of C#?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

R. Tomasi
Posts: 307
Joined: Wed Sep 01, 2021 4:08 pm
Location: Germany
Full name: Roland Tomasi

Re: Why C++ instead of C#?

Post by R. Tomasi »

mvanthoor wrote: Wed Sep 22, 2021 12:10 pm
klx wrote: Wed Sep 22, 2021 5:15 am Huh, how can I be wrong that I've never heard of it? There's no mention of "mono" at the official .NET wikipedia page:

https://en.wikipedia.org/wiki/.NET

I'm not on Windows and yes I'm running Microsoft .NET not "Mono".
Sometimes I wonder if you're serious or trolling.

Of course MS doesn't mention Mono on their official pages. It's not a Microsoft project; they only sponsor it with documentation and a bit of development effort. Mono is much older than Microsoft's own port of .NET (Core) to Linux. Mono has been around since the .NET 1.1 days. Actually, the original starter of the project is Miguel de Icaza. (The same guy who started Gnome, then abandoned Linux to move to a Mac because he was of the opinion that Linux had become a mess,, and he now works for Microsoft, porting software to Linux and Mac.)

Does .NET actually run on Linux? AFAIK, it's only .NET Core that runs on Linux, but since version 5, everything is called .NET again I believe. I lost track at some point.
That's the point where I realize that I have been out of the .net world for to long: I wasn't even aware that there is any .net from Microsoft running on Linux.
User avatar
lithander
Posts: 881
Joined: Sun Dec 27, 2020 2:40 am
Location: Bremen, Germany
Full name: Thomas Jahn

Re: Why C++ instead of C#?

Post by lithander »

klx wrote: Wed Sep 22, 2021 5:15 am Lithander, please set this straight at your earliest convenience.
TLDR: Using .Net 6 is fine.

Back in the day C# required the .Net Framework to run and this was a proprietary technology of Microsoft and only available on Windows. But there was an in-official, open source re-implementation called Mono. So you could get your C# code to run on e.g. Linux but the runtime was always a few versions behind, missing features and it was generally much slower. Mono is still used in the Unity Game engine so it's not completely dead. The proprietary Windows exclusive .Net Framework is also still around and the last version (4.8) was released about 2 years ago.

But since Microsoft decided to go open-source in 2014 with .Net Core the multi-platform, open-source framework of which the most recent version is called .NET 6 is definitely the new standard. And it's the best way to run C# on non-Windows platforms!
Minimal Chess (simple, open source, C#) - Youtube & Github
Leorik (competitive, in active development, C#) - Github & Lichess
pedrojdm2021
Posts: 157
Joined: Fri Apr 30, 2021 7:19 am
Full name: Pedro Duran

Re: Why C++ instead of C#?

Post by pedrojdm2021 »

lithander wrote: Wed Sep 22, 2021 2:50 pm
klx wrote: Wed Sep 22, 2021 5:15 am Lithander, please set this straight at your earliest convenience.
TLDR: Using .Net 6 is fine.

Back in the day C# required the .Net Framework to run and this was a proprietary technology of Microsoft and only available on Windows. But there was an in-official, open source re-implementation called Mono. So you could get your C# code to run on e.g. Linux but the runtime was always a few versions behind, missing features and it was generally much slower. Mono is still used in the Unity Game engine so it's not completely dead. The proprietary Windows exclusive .Net Framework is also still around and the last version (4.8) was released about 2 years ago.

But since Microsoft decided to go open-source in 2014 with .Net Core the multi-platform, open-source framework of which the most recent version is called .NET 6 is definitely the new standard. And it's the best way to run C# on non-Windows platforms!
As a Unity game developer, i can confirm, it is sad that Unity is still running with mono, they say that they have plans to move to the . Net CLR and .net 5 , but they don't have any date yet :oops:
klx
Posts: 179
Joined: Tue Jun 15, 2021 8:11 pm
Full name: Emanuel Torres

Re: Why C++ instead of C#?

Post by klx »

lithander wrote: Wed Sep 22, 2021 2:50 pm Microsoft decided to go open-source in 2014 with .Net Core the multi-platform, open-source framework of which the most recent version is called .NET 6
Thanks for clarifying.

Well, Tomasi and Amanjpro, sounds like you owe me an apology now.
[Moderation warning] This signature violated the rule against commercial exhortations.
R. Tomasi
Posts: 307
Joined: Wed Sep 01, 2021 4:08 pm
Location: Germany
Full name: Roland Tomasi

Re: Why C++ instead of C#?

Post by R. Tomasi »

klx wrote: Thu Sep 23, 2021 1:59 am
lithander wrote: Wed Sep 22, 2021 2:50 pm Microsoft decided to go open-source in 2014 with .Net Core the multi-platform, open-source framework of which the most recent version is called .NET 6
Thanks for clarifying.

Well, Tomasi and Amanjpro, sounds like you owe me an apology now.
lol - I owe you nothing at all.

I did not insult you, nor did I do anything else to you. If anything, it's you who owes apologies to the people you called confused because the "seasoned" C# developer that you claim to be never heard of mono... :roll:

But you see, thing is: I don't care about you ;)
klx
Posts: 179
Joined: Tue Jun 15, 2021 8:11 pm
Full name: Emanuel Torres

Re: Why C++ instead of C#?

Post by klx »

R. Tomasi wrote: Wed Sep 22, 2021 11:48 am On a side note, I have to apologize to you
apology accepted
[Moderation warning] This signature violated the rule against commercial exhortations.
R. Tomasi
Posts: 307
Joined: Wed Sep 01, 2021 4:08 pm
Location: Germany
Full name: Roland Tomasi

Re: Why C++ instead of C#?

Post by R. Tomasi »

klx wrote: Thu Sep 23, 2021 1:59 am
lithander wrote: Wed Sep 22, 2021 2:50 pm Microsoft decided to go open-source in 2014 with .Net Core the multi-platform, open-source framework of which the most recent version is called .NET 6
Thanks for clarifying.

Well, Tomasi and Amanjpro, sounds like you owe me an apology now.
R. Tomasi wrote: Wed Sep 22, 2021 11:48 am On a side note, I have to apologize to you guys: I simply did not find the time yet to make the changes to the C version that I promised. :oops: Unless someone beats me to it, I will however do them in short time.
The relation between these being what, exactly?
amanjpro
Posts: 883
Joined: Sat Mar 13, 2021 1:47 am
Full name: Amanj Sherwany

Re: Why C++ instead of C#?

Post by amanjpro »

klx wrote: Thu Sep 23, 2021 1:59 am
lithander wrote: Wed Sep 22, 2021 2:50 pm Microsoft decided to go open-source in 2014 with .Net Core the multi-platform, open-source framework of which the most recent version is called .NET 6
Thanks for clarifying.

Well, Tomasi and Amanjpro, sounds like you owe me an apology now.

Go season yourself :P
User avatar
lithander
Posts: 881
Joined: Sun Dec 27, 2020 2:40 am
Location: Bremen, Germany
Full name: Thomas Jahn

Re: Why C++ instead of C#?

Post by lithander »

R. Tomasi wrote: Wed Sep 22, 2021 11:48 am On a side note, I have to apologize to you guys: I simply did not find the time yet to make the changes to the C version that I promised. :oops: Unless someone beats me to it, I will however do them in short time.
I made a tiny change to the C source when I added the accumulated stats to the C# to make it easier to compare the two but I didn't optimize anything. So, once you have a new version let me know and I'll gladly upload it to make the comparison fair again.
klx wrote: Tue Sep 21, 2021 10:27 am I just copied the v1.4 changes to Java, and reran all tests with a slightly cooler CPU than last time (I don't have a fixed clock speed, so the results are not very stable). The new results are:

Code: Select all

C: 19600 ms
Java: 32048 ms (1.64x)
C#: 32858 ms (1.68x)
Let's put the Java version in the repo, too! Send me a PM or post it here and I'll add it.
Minimal Chess (simple, open source, C#) - Youtube & Github
Leorik (competitive, in active development, C#) - Github & Lichess
spirch
Posts: 95
Joined: Fri Nov 09, 2012 12:36 am

Re: Why C++ instead of C#?

Post by spirch »

there is a lot of missing

Code: Select all

   [MethodImpl(MethodImplOptions.AggressiveInlining)]
in the code

if I put more I can easily go

from

Code: Select all

Total: 1361558651 Nodes, 27483ms, 49540K NPS
to

Code: Select all

Total: 1361558651 Nodes, 25102ms, 54239K NPS
which is a nice gain ... going to look more into other thing now