The first quarter of 2021 is out and as usual it is time for a new issues of .NET R&D Digest!
This issue contains bits of computer science, software development, security, performance, diagnostics and as usual – .NET.
Have a nice read!
- Trash Talk: Accelerating Garbage Collection on Integrated GPUs is Worthless (by Mohammad Dashti and Alexandra Fedorova)
Have you ever wonder if it is possible to speed up garbage collection by offloading some of its phases to GPU? In this paper Mohammad Dashti and Alexandra Fedorova present results of such a research. In this research they analyze how offloading the dominant phases (object copying and object marking) to integrated GPU can improve garbage collection performance compared to various CPU technics.
- There’s plenty of room at the Top: What will drive computer performance after Moore’s law? (by Charles E. Leiserson , Neil C. Thompson, Joel S. Emer, Bradley C. Kuszmaul, Butler W. Lampson, Daniel Sanchez, Tao B. Schardl)
Nowadays microprocessors performance improves much slower than it was a decade before. There is more way to speedup software up to 2 – 3 times just by replacing old microprocessor with a new one. So, what will drive software performance now? Will it be a next gen processing unit? Software optimization? In this paper by Charles E. Leiserson , Neil C. Thompson, Joel S. Emer, Bradley C. Kuszmaul, Butler W. Lampson, Daniel Sanchez, Tao B. Schardl you might find the answers.
- Unit isomorphisms (by Mark Seemann)
All programming languages have commonalities. At the same time, they all have their own peculiarities, to which most of us, developer, simply get used. We don’t ask why I should write
void(but probably should) if method doesn’t return a value – it is just a syntax. However, sometimes syntax can be a limitation. In this post Mark Seemann talks about fundamental distinction between methods which return value and method which doesn’t, how this difference is expressed and this can be related to ‘unit’.
- OAuth 2.0 flows explained in GIFs (by Hem)
As users we face OAuth 2.0 on daily basis. Every time we grant access to our data – we participate in one of OAuth 2.0 flows. But do you know how these flows work? What flows have you participated in just now? Of course there is an excellent RFC 6749 which you can go through and find all the answers but what if these flows could be animated… well 🙂 In this post Hem describes OAuth 2.0 flows with GIFs. Each flow is described by a short text and nice GIF visualization, which makes them very representative. If you’ve ever wondered how OAuth 2.0 flows work – check this out.
- We Should Become Good at Optimizing our Code (by Denis Bakhvalov)
Performance optimization is a hot topic. Especially when it comes to “whether developers should care about optimizations when there is smart compilers and brilliant hardware”. In this video, from Performance Summit conference, Denis Bakhvalov talks about why software optimizations aren’t end with compilers or by choosing the best (according to O) algorithm but instead requires (and will require more in future) understanding of underlying hardware and skill to identify and tune critical parts of the code. In addition to interesting topic, this video also mentions interesting research works, tools, and performance investigation technics.
- How to ease async call stacks analysis in PerfView (by Christophe Nasarre)
There are tools which are extremely powerful and … if don’t understand the logic behind the app then, dreadful. PerfView is a great tool but when you first time see it, it can be hard to use (especially after with rich UI). However, everything changes if you know what to do and to work with it. In this post Christophe Nasarre describes basics about working with PerfView tool on an example of extraction of useful information of
async-awaitcall stack. This post is a good starting point if you’ve never used PerfView but always wanted to 🙂
- The 8 most missing features in C# (by Konrad Kokosa)
Each version of C# brings more and more language features. Some to simplify day to day development, some to open new horizons. However, it is moving quite fast. In this post Konrad Kokosa shares a results of his questionnaire about “what are you missing in C#”. Some of the features already have living proposals, some of them are quite funny but the overall number of requests clearly demonstrate – C# is moving too slow to catch up with all community needs 🙂
- .NET Debugger in a single picture (by Konrad Kokosa and Sebastian Solnica)
Do you know what happens when you set a breakpoint in Visual Studio? If you don’t know and would like to know then this poster by Konrad Kokosa and Sebastian Solnica is what you need. It includes a step by step explanation of how managed debugger cooperates with operating system and CPU to halt program execution when it ‘hits’ a breakpoint.
- Getting started with the Roslyn APIs writing: code with code (by Steve Gordon)
Code generation is a great when you must transform metadata (ex. WSDL) into the code. In .NET there were multiple ways of doing it – CodeDOM, T4 templates,
Console.WriteLineand now we have two more ways of doing it – source generators and Roslyn API. In this post Steve Gordon demonstrates how you can use Roslyn API to generate a few empty C# classes in a single
.csfile with just a few lines of code. Besides a detailed explanation (as usual) the post also includes a link to helpful portal by Kirill Osenkov.
- ASP.NET Core dependency injection: what is the IServiceProvider and how is it build? (by Steve Gordon)
Dependency injection in .NET Core consists of multiple components. In this post Steve Gordon continues his series about dependency inject (previous post was dedicated to
IServiceCollection) and does a deep dive into what
IServiceProvideris and how it is implemented internally. As usual, this post is full of code snippets and detailed explanations.
- Debugging configuration values in ASP.NET Core (by Andrew Lock)
One of the things that really unit all frameworks in all languages is that there is always something that you don’t know, even when you are using it every day. In this post Andrew Lock re-shares and then explains in details of how can you print all you configuration (configured in
IConfigurationRoot) with a single framework extension method. Besides the practical example Andrew also dives into the function implementation and shares a simple way to expose it output in development environment through the API.
- Loop alignment in .NET 6 (by Kunal Pathak)
Due to excessive complexity of modern CPUs squeezing additional bits of performance from application is hard, especially when you are not working directly with the metal. In .NET there are a lot of things which allow us to write high performance code, however, some of the tricks aren’t accessible for developers (the same in many cases applies to unmanaged languages like C++ too). One of such things is loop alignment. In this post Kunal Pathak explains in details what loop alignment is, how it works, what benefits and problems it can bring and how it is implemented a part of .NET 6 work.
Watch & Learn
- Troubleshooting .NET GC Issues (by Konrad Kokosa and Christophe Nasarre)
When you look at how someone does application diagnostics (especially using WinDbg) it looks like “true hacking” 🙂 But application diagnostics is a skill everyone can master. However, not all of developers need to be pro in application diagnostics and investigate crazy unpredictable issues. In general cases it is enough to understand how events are produces, how you can control them and how you can use them to leave a plenty of information to simplify future diagnostics. In this webinar Konrad Kokosa disconnects and Christophe Nasarre talks about what sources of diagnostics information we can use to understand .NET Framework and .NET Core applications, how this diagnostics is implemented (in Linux and Windows), how we can consume it and about general concepts of how to do application diagnostics.
P.S. please listen to Q&A section because it includes answers to quite interesting questions.