Friday, May 26, 2017

Using RyuJIT, the next generation JIT compiler for .NET

RyuJIT is the next generation Just-In-Time (JIT) compiler for .NET. It uses a high-performance JIT architecture, focused on high throughput JIT compilation. It is much faster than the existing JIT64 64-bit JIT that has been used for the last 10 years.  Before  the 32-bit JIT compiler was a lot faster than the 64-bit version making it sometimes better to compile and run your .NET application in 32-bit.

With the introduction of RyuJIT this gap is finally closed, making it easier to exclusively target 64-bit architectures or migrate workloads from 32- to 64-bit.

What should I do to enable RyuJIT?

The answer is simple; nothing Smile! If you have .NET Framework 4.6 installed, RyuJIT will be enabled for all 64-bit processes running on top of it. Your app will run in a 64-bit process if it is compiled as 64-bit or AnyCPU (although not as Prefer 32-bit), and run on a 64-bit operating system. RyuJIT is similarly integrated into .NET Core, as the 64-bit JIT.

If your servers are 64-bit(they probably are), and your applications are still using 32-bit, it’s time to do some benchmarking and maybe make the switch to 64-bit all the way!

Here is a link to the first time RuyJIT was announced almost 4 years ago: https://blogs.msdn.microsoft.com/dotnet/2013/09/30/ryujit-the-next-generation-jit-compiler-for-net/

Thursday, May 25, 2017

Essential Angular

2 of the core contributors of Angular Victor Savkin and Jeff Cross created a short but complete blog series about all aspects of the Angular framework. If you have never used Angular before or if you want to get a better understanding of how the framework is architected this is a great introduction.

Essential Angular

Here is the full list of posts:

Remark: You can also check out the Essential Angular book, which has some extra content not available in the blog series.

Wednesday, May 24, 2017

Greatness by David Marquet

My boss sent me a link to the following Youtube video:

I especially liked the following quote in the presentation:

“Take control and attract followers. Give control and create leaders”

Tuesday, May 23, 2017

The Microsoft Azure App

While getting up to date with all the great announcements at Build 2017 I noticed a small but interesting fact. It turns out that Microsoft has a mobile app (for iOS and Android) that allows you to manage Azure from your mobile device.

image image

From the documentation:

The Microsoft Azure app helps you keep track of your resources while on-the-go:
- Stay connected to the cloud and check status and critical metrics anytime, anywhere
- Stay informed with notifications and alerts about important health issues
- Stay in control of your resources and take corrective actions, like starting and stopping VMs and web apps

Great! Now can I spin up a new VM while being stuck in traffic Winking smile

Monday, May 22, 2017

TypeScript–Functional magic with discriminated unions and pattern matching

If you like the Functional style of programming, you will be happy to know that TypeScript supports discriminated unions. Instead of using inheritance and creating full blown classes, you can create a simple type that can be of different ‘subtypes’, e.g. a shape can either be a circle, rectangle or square:

This is already a lot less code then when using classes, but another advantage is you can now use pattern matching over this type. The TypeScript uses control flow based type analysis and can identify the different cases in the switch and provides the correct intellisense in each case:

image

Note that I’m using another nice trick to warn me if I missed a switch statement by adding an assertNever function that throws an exception if I forgot to implement one of the cases:

image

Here is the related code:

More information at https://www.typescriptlang.org/docs/handbook/advanced-types.html

Friday, May 19, 2017

VS Code–Angular Language Service

Yesterday while listening to the Adventures in Angular Podcast, I heard someone mention the Angular Language Service extension for VS Code.

From the documentation:

This extension provides a rich editing experience for Angular templates, both inline
and external templates including:

  • Completions lists
  • AOT Diagnostic messages
  • Quick info
  • Go to definition

demo

Thursday, May 18, 2017

Improve performance of your ASP.NET Core application

ASP.NET Core is running on Kestrel, ASP.NET Core’s internal web server. Although really fast Kestrel is not a full blown web server. The idea is that you put another web server(on Windows typically IIS) in front of it that acts as a proxy and forwards the requests to Kestrel.

To get this working in IIS, an AspNetCoreModule exists that achieves this goal. Here is the web.config that configures all of this:

If you look at the configuration, you see that by default all request(path="*" verb="*") are forwarded to Kestrel. This isn't ideal because Kestrel is a lot slower in handling static files than IIS.

A better solution is to only forward the requests that should be handled by ASP.NET Core(by example; path="api/*" verb="*") and let other requests be served by IIS.

The magic trick is to use IIS URL Rewrite rules to forward requests to the wwwroot folder of your ASP.NET Core app:

UPDATE: Rick Strahl did a more complete blog post where he took this approach a few steps further: https://weblog.west-wind.com/posts/2017/Apr/27/IIS-and-ASPNET-Core-Rewrite-Rules-for-AspNetCoreModule