I Ran a Chess Programming Tournament, Here's How it Went!
https://www.youtube.com/watch?v=Ne40a5LkK6A [www.youtube.com]
2023-12-21 02:11
tag: csharp
I Ran a Chess Programming Tournament, Here's How it Went!
https://www.youtube.com/watch?v=Ne40a5LkK6A [www.youtube.com]
2023-12-21 02:11
A Massive Leak
https://thedailywtf.com/articles/a-massive-leak [thedailywtf.com]
2020-08-05 01:04
“Memory leaks are impossible in a garbage collected language!” is one of my favorite lies. It feels true, but it isn’t. Sure, it’s much harder to make them, and they’re usually much easier to track down, but you can still create a memory leak. Most times, it’s when you create objects, dump them into a data structure, and never empty that data structure. Usually, it’s just a matter of finding out what object references are still being held. Usually.
A few months ago, I discovered a new variation on that theme. I was working on a C# application that was leaking memory faster than bad waterway engineering in the Imperial Valley.
This Goes to Eleven - Decimating Array.Sort with AVX2
https://bits.houmus.org/2020-01-28/this-goes-to-eleven-pt1 [bits.houmus.org]
2020-04-09 23:39
Let’s get in the ring and show what AVX/AVX2 intrinsics can really do for a non-trivial problem, and even discuss potential improvements that future CoreCLR versions could bring to the table.
Everyone needs to sort arrays, once in a while, and many algorithms we take for granted rely on doing so. We think of it as a solved problem and that nothing can be further done about it in 2020, except for waiting for newer, marginally faster machines to pop-up. However, that is not the case, and while I’m not the first to have thoughts about it; or the best at implementing it, if you join me in this rather long journey, we’ll end up with a replacement function for Array.Sort, written in pure C# that outperforms CoreCLR’s C++2 code by a factor north of 10x on most modern Intel CPUs, and north of 11x on my laptop. Sounds interesting? If so, down the rabbit hole we go…
Very well done.
"Stubs" in the .NET Runtime
http://www.mattwarren.org/2019/09/26/Stubs-in-the-.NET-Runtime/ [www.mattwarren.org]
2019-09-26 20:14
‘Stubs’, as they’re known in the runtime (sometimes ‘Thunks’), provide a level of indirection throughout the source code, there’s almost 500 mentions of them!
This post will explore what they are, how they work and why they’re needed.
C#88: The Original C#
https://medium.com/@ricomariani/c-88-the-original-c-66a1b5de47d7 [medium.com]
2019-04-01 08:08
Every once in a while the topic of the original C# (vintage 1988) comes up. This is the project for which I was recruited to Microsoft and it was a very interesting beast, with even more interesting colleagues. I thought I would write a few notes about this system while I still remembered the basics of how it worked. Obviously a much longer article would be necessary to get everything down but you should be able to get sense of its operation from this primer. At its zenith, C#88 was able to build and run “Omega” — what you would now call Microsoft Access.
source: HN
.NET Internals Cookbook
https://blog.adamfurmanek.pl/2019/02/16/net-internals-cookbook-part-0/ [blog.adamfurmanek.pl]
2019-03-09 18:47
In this series I answer various .NET questions. Some of them are asked during interviews, some of them I see on the internet, some of them are completely made up. The goal is to provide short answer with links to references if needed. This is by no means a .NET tutorial or experts reference, this is just a bunch of useful answers to refresh your knowledge.
Some of this gets pretty deep actually.
source: L
Is C# a low-level language?
https://mattwarren.org/2019/03/01/Is-CSharp-a-low-level-language/ [mattwarren.org]
2019-03-01 16:30
Specifically, what happens when translating a C++ raytracer and trying to make it fast.
I started by simply porting the un-obfuscated C++ code line-by-line to C#. Turns out that this was pretty straight forward, I guess the story about C# being C++++ is true after all!!
source: L
An Exhausting List of Differences Between VB.NET & C#
https://anthonydgreen.net/2019/02/12/exhausting-list-of-differences-between-vb-net-c/ [anthonydgreen.net]
2019-02-12 20:31
Before I joined Microsoft I might have vaguely held that idea too and used it in arguments to push back against detractors or reassure someone. I understand its allure. It’s easy to grasp and very easy to repeat. But, working on Roslyn–the complete from-the-ground-up rewrite of both VB and C#–for 5 years, I came to understand how unequivocally false this idea really is. I worked with a team of developers and testers to re-implement from scratch every inch of both languages as well as their tooling in a huge multi-project solution with millions of lines of code written in both. And with so many developers switching back and forth between them, and a high bar for compatibility with the outputs and experiences of previous versions, and the need to faithfully represent every detailed nuance throughout a massive API surface area I got to be intimately familiar with the differences.
This list is not exhaustive. It’s exhausting. It’s not all the differences there are, it’s not even all the differences I’ve ever known, it’s just the differences I can remember off the top of my head until such time as I become too tired to go on; until I’m exhausted. If I or others run into or remember other differences I’ll gladly update this list after the fact.
Fixing random
https://ericlippert.com/2019/01/31/fixing-random-part-1/ [ericlippert.com]
2019-01-31 21:55
How to say this delicately?
I really, really dislike System.Random. Like, with a passion. It is so… awful.
But the really fundamental problem here is that we’re working at too low a level. It is not the 1970s anymore, when rand() was good enough. We have sophisticated problems in statistical modeling and the attendant probabilistic reasoning to solve in modern programming languages. We need to up our game.
And then the series continues on at some length.
https://ericlippert.com/2019/02/04/fixing-random-part-2/
https://ericlippert.com/2019/02/07/fixing-random-part-3/
https://ericlippert.com/2019/02/11/fixing-random-part-4/
https://ericlippert.com/2019/02/14/fixing-random-part-5/
https://ericlippert.com/2019/02/19/fixing-random-part-6/
https://ericlippert.com/2019/02/21/fixing-random-part-7/
https://ericlippert.com/2019/02/26/fixing-random-part-8/
https://ericlippert.com/2019/02/28/fixing-random-part-9/
https://ericlippert.com/2019/03/04/fixing-random-part-10/
https://ericlippert.com/2019/03/07/fixing-random-part-11/
https://ericlippert.com/2019/03/11/fixing-random-part-12/
Indexer error cases
https://ericlippert.com/2019/01/18/indexer-error-cases/ [ericlippert.com]
2019-01-18 21:09
in C# (and also in Java and many other languages), it is the assignment itself that triggers the exception, even when the exception is the result of an indexing operation.
Dual numbers
https://ericlippert.com/2019/01/07/dual-numbers-part-1/ [ericlippert.com]
2019-01-17 23:23
I’ve recently been looking into a fascinating corner of mathematics that at first glance appears a little bit silly, but actually has far-reaching applications, from physics to numerical methods to machine learning. I thought I’d share what I’ve learned over the next few episodes.
I assume you recall what a complex number is, but perhaps not all of the details. A complex number is usually introduced as a pair of real numbers (a, b), where a is called the “real part” and b is called the “imaginary part”.
A brief aside: it has always bugged me that these labels are unnecessarily value-laden. There is no particular “reality” that is associated with the real part; it is every bit as “imaginary” as the imaginary part. They might as well be called the “rezrov part” and the “gnusto part”, but we’re stuck with “real” and “imaginary”. Moving on.
Building C# 8.0
https://blogs.msdn.microsoft.com/dotnet/2018/11/12/building-c-8-0/ [blogs.msdn.microsoft.com]
2018-11-14 22:47
Here’s an overview of the most significant features slated for C# 8.0. There are a number of smaller improvements in the works as well, which will trickle out over the coming months.
Fuzzing the .NET JIT Compiler
http://www.mattwarren.org/2018/08/28/Fuzzing-the-.NET-JIT-Compiler/ [www.mattwarren.org]
2018-08-28 21:03
I recently came across the excellent ‘Fuzzlyn’ project, created as part of the ‘Language-Based Security’ course at Aarhus University. As per the project description Fuzzlyn is a: … fuzzer which utilizes Roslyn to generate random C# programs
Oops, I Wrote a C++ Compiler
https://praeclarum.org/2018/08/27/oops-i-wrote-a-c-compiler.html [praeclarum.org]
2018-08-27 20:06
TLDR; I wrote a .NET library that can compile C/C++ code into a byte code that it can also interpret. It is used in my app iCircuit to simulate Arduinos.
source: L
First Steps with Nullable Reference Types
https://codeblog.jonskeet.uk/2018/04/21/first-steps-with-nullable-reference-types/ [codeblog.jonskeet.uk]
2018-05-16 19:35
This blog post is effectively a log of my experience with the preview of the C# 8 nullable reference types feature. There are lots of caveats here: it’s mostly “as I go along” so there may well be backtracking. I’m not advising the right thing to do, as I’m still investigating that myself. And of course the feature is still changing. Oh, and this blog post is inconsistent about its tense. Sometimes I write in the present tense as I go along, sometimes I wrote in the past tense afterwards without worrying about it. I hope this isn’t/wasn’t/won’t be too annoying.
Performance Improvements in .NET Core 2.1
https://blogs.msdn.microsoft.com/dotnet/2018/04/18/performance-improvements-in-net-core-2-1/ [blogs.msdn.microsoft.com]
2018-05-10 16:25
Back before .NET Core 2.0 shipped, I wrote a post highlighting various performance improvements in .NET Core 2.0 when compared with .NET Core 1.1 and the .NET Framework. As .NET Core 2.1 is in its final stages of being released, I thought it would be a good time to have some fun and take a tour through some of the myriad of performance improvements that have found their way into this release.
How generics were added to .NET
http://mattwarren.org/2018/03/02/How-generics-were-added-to-.NET/ [mattwarren.org]
2018-03-22 16:48
Before we dive into the technical details, let’s start with a quick history lesson, courtesy of Don Syme who worked on adding generics to .NET and then went on to design and implement F#, which is a pretty impressive set of achievements!
There are some significant differences between the Rotor source code and the real .NET framework. Most notably the JIT and GC are completely different implementations (due to licensing issues, listen to DotNetRocks show 360 - Ted Neward and Joel Pobar on Rotor 2.0 for more info). However, the Rotor source does give us an accurate idea about how other core parts of the CLR are implemented, such as the Type-System, Debugger, AppDomains and the VM itself. It’s interesting to compare the Rotor source with the current CoreCLR source and see how much of the source code layout and class names have remained the same.
Announcing .NET Core 2.1 Preview 1
https://blogs.msdn.microsoft.com/dotnet/2018/02/27/announcing-net-core-2-1-preview-1/ [blogs.msdn.microsoft.com]
2018-03-09 18:28
Faster, features, etc.
.NET Core 2.1 Roadmap
https://blogs.msdn.microsoft.com/dotnet/2018/02/02/net-core-2-1-roadmap/ [blogs.msdn.microsoft.com]
2018-02-07 02:44
We have been thinking of .NET Core 2.1 as a feedback-oriented release after the more foundational .NET Core 2.0 release. The following improvements are based on some of the most common feedback.
Resources for Learning about .NET Internals
http://mattwarren.org/2018/01/22/Resources-for-Learning-about-.NET-Internals/ [mattwarren.org]
2018-01-23 14:07
I wouldn’t recommend reading through the entire list, at least not in one go, your brain will probably melt. Picks some posts/topics that interest you and start with those.