runtimelab
command-line-api
Our great sponsors
runtimelab | command-line-api | |
---|---|---|
51 | 22 | |
1,323 | 3,282 | |
1.4% | 1.1% | |
5.1 | 7.8 | |
about 4 hours ago | 8 days ago | |
C# | ||
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
runtimelab
-
Why choose async/await over threads?
Experiment result write-up: https://github.com/dotnet/runtimelab/blob/e69dda51c7d796b812...
TLDR: The green threads experiment was a failure as it found (expected and obvious) issues that the Java applications are now getting to enjoy, joining their Go colleagues, while also requiring breaking changes. It, however, gave inspiration to subsequent re-examination of current async/await implementation and whether it can be improved by moving state machine generation and execution away from IL completely to runtime. It was a massive success as evidenced by preliminary overhead estimations in the results.
-
Garnet – A new remote cache-store from Microsoft Research
Yeah, it kind of is. There are quite a few of experiments that are conducted to see if they show promise in the prototype form and then are taken further for proper integration if they do.
Unfortunately, object stack allocation was not one of them even though DOTNET_JitObjectStackAllocation configuration knob exists today, enabling it makes zero impact as it almost never kicks in. By the end of the experiment[0], it was concluded that before investing effort in this kind of feature becomes profitable given how a lot of C# code is written, there are many other lower hanging fruits.
To contrast this, in continuation to green threads experiment, a runtime handled tasks experiment[1] which moves async state machine handling from IL emitted by Roslyn to special-cased methods and then handling purely in runtime code has been a massive success and is now being worked on to be integrated in one of the future version of .NET (hopefully 10?)
[0] https://github.com/dotnet/runtime/issues/11192
[1] https://github.com/dotnet/runtimelab/blob/feature/async2-exp...
-
JEP Draft – Derived Record Creation (Preview) – Java
The only way to avoid it is to not build on top of Java or not adding any features on top of Java.
> To give another example with C#, there has been a lot of recent discussion about finding potential alternatives to their async-await concurrency model. They cite the level of effort it takes to maintain the async await style code and the costs that come from this.
I had a very different take-away. They did PoC with virtual threads and decided it's not worth the switch now and async-await that they have is good enough.
https://github.com/dotnet/runtimelab/issues/2398
> Some of the languages it gets compared too aren't even that old yet.
C# is old enough to drink and Scala just had its 20th birthday this week :)
-
.NET 8 – .NET Blog
It was tried and the dotnet team decided to drop it: https://github.com/dotnet/runtimelab/issues/2398
-
.NET Green Thread Experiment Results
Technical details here: https://github.com/dotnet/runtimelab/blob/feature/green-thre...
-
Thread-per-Core
Just last month .NET ended a green threading experiment, mainly because the overhead it adds to FFI was too high:
https://github.com/dotnet/runtimelab/issues/2398
Rust had green threads until late 2014, and they were removed because of their impact on performance.
Everyone has done the basic research: green threading is a convenient abstraction that comes with certain performance trade offs. It doesn't work for the kind of profile that Rust is trying to target.
- Java 21 makes me like Java again
-
The compact overview of JDK 21’s “frozen” feature list
Green Threads Experiment if anyone is interested in what they've done in .NET: https://github.com/dotnet/runtimelab/issues/2057
Personally Asyc/Await is the only thing keeping me from the C# ecosystem.
-
Question about NativeAOT platform support
There is a compiler being developed by the community (which is experimental and not supported by Microsoft) which supports full AOT: https://github.com/dotnet/runtimelab/tree/feature/NativeAOT-LLVM
command-line-api
-
DotMake Command-Line VS command-line-api - a user suggested alternative
2 projects | 13 Dec 2023
System.CommandLine is a very good parser but you need a lot of boilerplate code to get going and the API is hard to discover.
-
How to configure true dependency injection in System.CommandLine
using System.CommandLine.Invocation; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; namespace System.CommandLine.Builder; internal static class DependencyInjectionMiddleware { public static CommandLineBuilder UseDependencyInjection(this CommandLineBuilder builder, Action configureServices) { return UseDependencyInjection(builder, (_, services) => configureServices(services)); } // This overload allows you to conditionally register services based on the command line invocation context // in order to improve startup time when you have a lot of services to register. public static CommandLineBuilder UseDependencyInjection(this CommandLineBuilder builder, Action configureServices) { return builder.AddMiddleware(async (context, next) => { // Register our services in the modern Microsoft dependency injection container var services = new ServiceCollection(); configureServices(context, services); var uniqueServiceTypes = new HashSet(services.Select(x => x.ServiceType)); services.TryAddSingleton(context.Console); await using var serviceProvider = services.BuildServiceProvider(); // System.CommandLine's service provider is a "fake" implementation that relies on a dictionary of factories, // but we can still make sure here that "true" dependency-injected services are available from "context.BindingContext". // https://github.com/dotnet/command-line-api/blob/2.0.0-beta4.22272.1/src/System.CommandLine/Invocation/ServiceProvider.cs context.BindingContext.AddService(_ => serviceProvider); foreach (var serviceType in uniqueServiceTypes) { context.BindingContext.AddService(serviceType, _ => serviceProvider.GetRequiredService(serviceType)); // Enable support for "context.BindingContext.GetServices<>()" as in the modern dependency injection var enumerableServiceType = typeof(IEnumerable<>).MakeGenericType(serviceType); context.BindingContext.AddService(enumerableServiceType, _ => serviceProvider.GetServices(serviceType)); } await next(context); }); } }
-
C# .NET Tools with System.CommandLine
command-line-api
-
Show HN: Replbuilder, quickly build a Python REPL CLI prompt
This looks really nice.
I've been spending a lot of time with python lately because of new project work, I had never really used python before. It's been really cool to keep finding stuff like this.
The equivalent of something like in the .net world (eg https://github.com/dotnet/command-line-api) and even powershell modules (https://learn.microsoft.com/en-us/powershell/module/microsof...) have a steeper learning curve and take significantly MORE work to set up for the end-user.
-
What is the best architecture for a Console app?
https://github.com/dotnet/command-line-api is a library that facilitates making commandline executables with nice arguments and options. It's a little complicated but if you're going to pack in a lot of functionality, you need something like this.
-
Thoughts on authoring cmdlets
if you're looking into command line utilities built in c#, you might want to check out System.CommandLine. You'll be able to build your comands in c#.
- Architecture pattern for Console Apps?
-
What's your favorite command line arg parser?
System.Commandline is my current favorite.
-
Why would you write extension methods for the type you own?
In the source of https://github.com/dotnet/command-line-api/tree/main/src/System.CommandLine there is a Command class which represents a invocation path for a command line program. There is a corresponding CommandExtensions class which is basically a set of extension methods for Command class. This library owns the Command class and yet extension methods are defined for it. What could be the reason for this decision when all the methods can be directly defined inside the command class?
Second, is what type "owns" the method. This is the crux of the matter. The library authors apparently decided that a Command should not be concerned with how a Command is invoked. If you look at the Command type, you see no Invoke method - at all. The library authors decided that a command should define what the command is but now how it's invoked. That responsibility is handled inside of the CommandExtensions class.
What are some alternatives?
spectre.console - A .NET library that makes it easier to create beautiful console applications.
Cocona - Micro-framework for .NET console application. Cocona makes it easy and fast to build console applications on .NET.
ILRepack - Open-source alternative to ILMerge
.NET Runtime - .NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
Command Line Parser - The best C# command line parser that brings standardized *nix getopt style, for .NET. Includes F# support
DNNE - Prototype native exports for a .NET Assembly.
FrameworkBenchmarks - Source for the TechEmpower Framework Benchmarks project
.NET-Obfuscator - Lists of .NET Obfuscator (Free, Freemium, Paid and Open Source )
csharplang - The official repo for the design of the C# programming language
CoreWCF - Main repository for the Core WCF project
Flee - Fast Lightweight Expression Evaluator