C#: IEnumerable, yield return, and lazy evaluation

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • .NET Runtime

    .NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.

  • Unfortunately, while I would love JIT to do such kind of optimizations, this is completely not how it works today.

    First and foremost, '&mut' in Rust is a mutable reference. The C# alternative is just 'ref'. Both point to specific addresses. 'Box' OTOH is a handle for a struct allocated on a heap, just like C#'s one is implementation-wise (except in C# they are further managed by runtime but that's besides the point).

    Now regarding the arrays - 'T[]' is strictly object withouts ifs and buts. There is no "short array" optimisation that would substitute array type with stack-allocated inline buffer. If you want this, you have to write it manually. See: https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6b...

    The last but not least, if the method signature accepts an argument by its interface type e.g. 'HandleEnumerable(IEnumerable values)', then the IEnumerable-implementing struct will be boxed before method can be called. C#/.NET doesn't do full generic monomorphization like Rust. Instead, for class-type generics a common '_Canon' method body will be JITted which will also implicitly accept generic-type arguments to correctly dispatch on an actual of the method. OTOH, for structs, all method calls will be fully monomorphized per each struct type. This means that you can avoid struct boxing when dispatching by interface by rewriting method signature to 'HandleEnumerable(TEnumerable values) where TEnumerable : IEnumerable'. In this case, unless you cast your struct to an interface type explicitly beforehand, the struct will not be boxed.

  • dotnet-nativeaot-labs

    Discontinued A place to learn about and experiment with .NET NativeAOT on AWS.

  • Speaking of serverless, this might be of interest to you: https://github.com/awslabs/dotnet-nativeaot-labs

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • ruby

    The Ruby Programming Language

  • UniTask

    Provides an efficient allocation free async/await integration for Unity.

  • IIRC there's a little more work needed for unity, but Cysharp has you covered (https://github.com/Cysharp/UniTask)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Building a bare-metal bootable game for Raspberry Pi in C#

    4 projects | news.ycombinator.com | 11 Dec 2023
  • Do you think this programmer's argument is correct?

    2 projects | /r/dotnet | 9 Jul 2023
  • Do you think C# will be decentralized in the future?

    4 projects | /r/dotnet | 24 Jun 2023
  • wrapped_mono 0.3 - run C#/F# code inside your rust projects!

    2 projects | /r/rust | 22 Apr 2023
  • .Net7 broke DefaultInterpolatedStringHandler?

    2 projects | /r/csharp | 27 Mar 2023