CKTIS / C#
performance and complexity: практическа справка
performance and complexity: практическа справка: Производителността обхваща време, заделяния, I/O, конкурентност и характеристики на данните.
Версия: C# language and .NET 10 reference runtime
Синтаксис
// performanceПроизводителността обхваща време, заделяния, I/O, конкурентност и характеристики на данните.
Мерете с реалистичен benchmark преди оптимизация и профилирайте доминиращия разход.
Микрооптимизация може да влоши четимостта без промяна на общия резултат.
Warm-up JIT, GC, cache и вариацията на средата изкривяват единично измерване.
Пълната програма действително използва performance and complexity; точният очакван stdout е 5050.
Примери
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);
Резултат
5050
Пълната програма действително използва `performance and complexity`; точният очакван stdout е `5050`.