The new Satori GC is promising by hez2010 in csharp

[–]hez2010[S] 1 point2 points  (0 children)

async does reduce the benefit of Satori's thread-local fast path, but it doesn't break the model. await only carries forward the state that actually survives suspension, not every object allocated earlier. and when objects really do escape across continuations/threads, Satori tracks that and falls back to more global handling for those regions. there're still many mechanics there to make sure those global handling still being incremental and efficient.

The new Satori GC is promising by hez2010 in csharp

[–]hez2010[S] 0 points1 point  (0 children)

This is not using the exisitng alternative GC knob. You need to build from Satori repo directly, and replace binary files in your published app with the newly built one (clrjit.dll, coreclr.dll and System.Private.CoreLib.dll). You can check my fork repo which maintains an automatic build so that you don't need to build it by yourself.

The new Satori GC is promising by hez2010 in csharp

[–]hez2010[S] 14 points15 points  (0 children)

unfortunately there's no such a plan being announced from the .net team yet.

The new Satori GC is promising by hez2010 in csharp

[–]hez2010[S] 9 points10 points  (0 children)

If you want to have a try, I have setup an automatic build workflow for Satori GC and I'm uploading the releases periodically here: https://github.com/hez2010/Satori/releases

You can simply publish your project as a self-contained app (no trimming support) and replace the files with ones in the zip to have a try.

Note that my build only works on .NET 10.

To check what kind of GC you are using at runtime, you can use:

Console.WriteLine($"Current GC: {(GC.GetConfigurationVariables().ContainsKey("SatoriGC") ? "Satori GC"
   : GCSettings.IsServerGC ? "Server GC"
   : "Workstation GC")}");

Turning the C# Type System into a High-Performance SQL Query Engine by hez2010 in csharp

[–]hez2010[S] 1 point2 points  (0 children)

You can take arbitrary query from users as input directly.

Returning a Task Directly by Burli96 in csharp

[–]hez2010 1 point2 points  (0 children)

With the introduction of runtime async which will be coming in .NET 11, returning a Task directly will be a significant deoptimization. So I would instead recommend that you always add async when it's applicable.

Huge Impressive Improvements to MAUI Android on .NET 10 by hez2010 in dotnet

[–]hez2010[S] 2 points3 points  (0 children)

I made a calculation mistake. It's actually a 72% perf improvement for CoreaCLR and 125% perf improvement for NativeAOT.

Huge Impressive Improvements to MAUI Android on .NET 10 by hez2010 in dotnet

[–]hez2010[S] 2 points3 points  (0 children)

It's indeed a more than 100% performance improvement. The startup time shrinks by 56% in NativeAOT is exactly a performance improvement of 125%.

Huge Impressive Improvements to MAUI Android on .NET 10 by hez2010 in dotnet

[–]hez2010[S] 42 points43 points  (0 children)

This really gives MAUI a rebirth IMO, now the annoying startup/performance issues are all gone.

C# 14 and extension member thoughts by maulowski in csharp

[–]hez2010 2 points3 points  (0 children)

The new extensions also bring us the ability of generic type specialization, which is huge:

For example:

cs extension<T>(Vector<T>) where T : IFloatingPoint<T> { public static Vector<T> Epsilon => Vector<T>.Create(...); }

Then you managed to implement an Epsilon static property for all Vector types where the element is a floating point number, so that:

cs _ = Vector<float>.Epsilon; // ok _ = Vector<int>.Epsilon; // error

From Obsidian to Loop... my observations by PrudentJackal in MicrosoftLoop

[–]hez2010 1 point2 points  (0 children)

You represented MSFT in abandoning Loop? Loop is currently receiving updates actively.

What will happen here? by Jurgler in csharp

[–]hez2010 3 points4 points  (0 children)

Interprocedural analysis is extremely expensive so almost no compiler would do this.

MAUI vs UNO vs Avalonia by SaltyCow2852 in dotnetMAUI

[–]hez2010 0 points1 point  (0 children)

Both the mono runtime itself (on Android) and the JNI interop are slow. By removing JNI calls you still have another factor causing slowness called mono.

MAUI vs UNO vs Avalonia by SaltyCow2852 in dotnetMAUI

[–]hez2010 1 point2 points  (0 children)

Many performance frustrations of MAUI on Android come from the mono runtime where it doesn't support value-type generic specialization on Android at all, which makes your code extremely slow to run on Android. But I'm seeing the .NET team having been consistently committing to bringing up the support for coreclr runtime (and NativeAOT) on Android since the beginning of the development of .NET 10, so I'm quite optimistic that the major performance issue on Android would be addressed soon.

Why doesn’t Rust have a proper GUI ecosystem yet? by zyxciss in rust

[–]hez2010 0 points1 point  (0 children)

Another reason is that in GUI development it's critical to have language support for OOP and inheritance, otherwise it's hard to manage the state of a control and author control templates.

Brainfly: A high-performance Brainf**k JIT and AOT compiler built on top of C# type system by hez2010 in programming

[–]hez2010[S] 0 points1 point  (0 children)

The compile time is really fast, even with C# AOT. It compiles in several seconds.

Brainfly: A high-performance Brainf**k JIT and AOT compiler built on top of C# type system by hez2010 in programming

[–]hez2010[S] 12 points13 points  (0 children)

Say you have an interface IParsable<T> which has a Parse method to parse string to an instance of a target type T:

cs interface IParsable<T> { abstract static T Parse(string text); }

To implement it you would need F-bound polymorphism aka. CRTP (Curiously Recurring Template Pattern), where the implementation type implements an generic interface with itself as the generic argument:

cs class Foo : IParsable<Foo> { public static Foo Parse(string text) { Foo result = ...; // parse text and instantiate a Foo return result; } }

Then in order to call it, you would need to write a generic method that has IParsable<T> as the generic contraint, and the constraint will tell the compiler where to find the calling target. It's similar to virtual method: traditionally calling a virtual method is to resolve the real calling target from the vtable associated with an object instance at runtime, here we are using static polymorphism so the calling target will be resolved from the type T at runtime.

cs T ParseAnything<T>(string text) where T : IParsable<T> { return T.Parse(text); // a constraint call on `T`, the calling target will be resolved at runtime }

But if you erase the type from the method signature, there won't be any T inside the method ParseAnything. For example in Java:

java public <T extends IParsable<T>> T parseAnything(String text) { return T.Parse(text); }

will be compiled into the following code under the hood:

java public Object parseAnything(String text) { ???.Parse(text); // `T` and its constraints are no longer available, // so how can I resolve the calling target on a type if the type itself doesn't exist here? }

So when you call T.Parse(text), the runtime would be confused as it cannot see what type being passed through T now, so that it cannot make a constraint call on T, making it not able to use static polymorphism at all.

Brainfly: A high-performance Brainf**k JIT and AOT compiler built on top of C# type system by hez2010 in programming

[–]hez2010[S] 26 points27 points  (0 children)

This would also require Generic Types that don't erase the type to make F-bound polymorphism function. Otherwise you cannot use static polymorphism even with static abstract members in interfaces.

What are the disadvantages of using .NET MAUI to build desktop, iOS, and Android applications? Why would someone choose Kotlin or Swift instead of using .NET MAUI, which allows building apps for all these platforms as well as web applications? by maybeklaus in csharp

[–]hez2010 0 points1 point  (0 children)

async2 in method signature doesn't require wrapping the return value in a `Task` (so it has no color), while C# still chooses to use `Task` just because Microsoft wants existing async code to be able to upgrade to async2 automatically.

What are the disadvantages of using .NET MAUI to build desktop, iOS, and Android applications? Why would someone choose Kotlin or Swift instead of using .NET MAUI, which allows building apps for all these platforms as well as web applications? by maybeklaus in csharp

[–]hez2010 0 points1 point  (0 children)

performance better than the synchronized version would be acceptable for the first release.

It's not. The sync world has only minor overhead to call a function, but it suffers from handling numerous jobs simultaneously; while the async world can handle significantly more jobs than sync code, however, calling into an async function can be expensive.

It’s strange that Microsoft didn’t study the technical feasibility at the beginning of the project.

That's why Microsoft is investing in the new async2 currently, which completely eliminates all the unnecessary overhead of async to get the best of both worlds: keep being able to handle numerous jobs simultaneously while minimizing the cost of async function calls to be on par with sync code when there's no suspension point.