CKTIS / C#
performance and complexity: odniesienie praktyczne
performance and complexity: odniesienie praktyczne: Wydajność obejmuje czas, alokacje, I/O, współbieżność i charakterystykę danych.
Wersja: C# language and .NET 10 reference runtime
Składnia
// performanceWydajność obejmuje czas, alokacje, I/O, współbieżność i charakterystykę danych.
Mierz realistycznym benchmarkiem przed optymalizacją i profiluj dominujący koszt.
Mikrooptymalizacja może pogorszyć czytelność bez wpływu na całość.
Warm-up JIT, GC, cache i wariancja środowiska zniekształcają pojedynczy pomiar.
Kompletny program rzeczywiście używa performance and complexity; oczekiwany stdout to dokładnie 5050.
Przykłady
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
var values = Enumerable.Range(1, 100).ToArray(); var sum = 0; foreach (var value in values) sum += value; Console.WriteLine(sum);
Wynik
5050
Kompletny program rzeczywiście używa `performance and complexity`; oczekiwany stdout to dokładnie `5050`.