csharpc

System.Collections.Generic.Queue

A library or CoreLib type served from the framework’s IL: its row of the per-library table of ADR 0023 (columns explained there, under “Measurements”).

Library (switch) Correctness (samples from IL) Binary size, IL / shadow Compile cpu, IL / shadow Speed, IL / shadow (time) Lines removed on a flip Decision NativeAOT on the same host, csharpc / NativeAOT (tools/il-first/measure-aot.sh: stripped size; compile cpu; run, median of 7; instructions)
System.Collections.Generic.Queue<T> and its enumerator (src/Csharpc/upstream-types/System.Collections.Generic.Queue.txt, a CoreLib type: the slicer route) 104 samples (every queue, stack, collection and generic sample, 1324 included) byte-identical to real .NET at -O0 and -O2; 103 of 104 via IL; 1160 failed the same way on main (Enumerable.OrderBy with a comparer had no implementation from IL: #376, fixed by #383). 325 passes via IL when compiled alone; the runs that reported it killed were out-of-memory kills from other compiles sharing the host queue_throughput 141 176 to 141 672 B (1.00x) 5.1 to 4.6 s (noise) queue_throughput (20 rounds of 1 M Enqueue with a Dequeue every fourth, Peek, foreach, 20 CopyTo, Contains, TryDequeue to empty, a Queue<string>): instructions 2 268 M to 1 951 M (0.86x), median of 5 324 to 216 ms 196 (corelib/Queue.cs) Flipped (#367). Correctness was the reason: the shadow had drifted from .NET (#363: CopyTo with element stores and no argument checks, fixed in #366); the framework’s Queue<T> is .NET’s code, version checks, exceptions and Array.Copy semantics included. queue_throughput: 141 416 / 1 341 224 B; compile cpu 21.4 / 11.0 s (csharpc’s first compile after the build, cold corelib cache; 4.6 s warm); run 220 / 439 ms (0.50x); 1.95 G / 3.04 G instructions