Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
- name: Setup .NET 8 SDK
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
with:
dotnet-version: 8.0.x
dotnet-version: 11.0.x

- name: Setup .NET SDK
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/AdventOfCode.Site/bin/Debug/net10.0/AdventOfCode.Site.dll",
"program": "${workspaceFolder}/src/AdventOfCode.Site/bin/Debug/net11.0/AdventOfCode.Site.dll",
"args": [],
"cwd": "${workspaceFolder}/src/AdventOfCode.Site",
"stopAtEntry": false,
Expand Down
2 changes: 1 addition & 1 deletion .vsconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "1.0",
"components": [
"Microsoft.NetCore.Component.Runtime.10.0",
"Microsoft.NetCore.Component.Runtime.11.0",
"Microsoft.NetCore.Component.SDK",
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Component.JavaScript.Diagnostics",
Expand Down
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<AssemblyIsCLSCompliant>false</AssemblyIsCLSCompliant>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)AdventOfCode.ruleset</CodeAnalysisRuleSet>
<Features>$(Features);runtime-async=on</Features>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<LangVersion>preview</LangVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<PublishForAWSLambda>false</PublishForAWSLambda>
Expand Down
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<ItemGroup>
<PackageVersion Include="Amazon.Lambda.AspNetCoreServer.Hosting" Version="2.1.0" />
<PackageVersion Include="Amazon.Lambda.RuntimeSupport" Version="2.1.1" />
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="BenchmarkDotNet" Version="0.16.0-nightly.20260604.559" />
<PackageVersion Include="GitHubActionsTestLogger" Version="3.0.4" />
<PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.7.1" />
<PackageVersion Include="MartinCostello.Testing.AwsLambdaTestServer" Version="0.12.1" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.9" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.9" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
<PackageVersion Include="Microsoft.OpenApi" Version="2.9.0" />
<PackageVersion Include="Microsoft.OpenApi" Version="3.7.0" />
<PackageVersion Include="Microsoft.Playwright" Version="1.60.0" />
<PackageVersion Include="Microsoft.Toolkit.HighPerformance" Version="7.1.2" />
<PackageVersion Include="Microsoft.TypeScript.MSBuild" Version="6.0.3" />
Expand Down
4 changes: 4 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
<configuration>
<packageSources>
<clear />
<add key="BenchmarkDotNet" value="https://www.myget.org/F/benchmarkdotnet/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<packageSourceMapping>
<packageSource key="BenchmarkDotNet">
<package pattern="BenchmarkDotNet*" />
</packageSource>
<packageSource key="NuGet">
<package pattern="*" />
</packageSource>
Expand Down
6 changes: 3 additions & 3 deletions crank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:
scenarios:
microbenchmarks:
application:
framework: net10.0
framework: net11.0
job: microbenchmarks
root:
application:
framework: net10.0
framework: net11.0
job: server
load:
framework: net10.0
framework: net11.0
job: bombardier
variables:
serverPort: 5000
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "10.0.301",
"version": "11.0.100-preview.5.26302.115",
"allowPrerelease": false,
"paths": [ ".dotnet", "$host$" ],
"errorMessage": "The required version of the .NET SDK could not be found. Please run ./build.ps1 to bootstrap the .NET SDK."
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode.Console/AdventOfCode.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<OptimizationPreference>Speed</OptimizationPreference>
<OutputType>Exe</OutputType>
<RootNamespace>MartinCostello.AdventOfCode.Console</RootNamespace>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode.Resources/AdventOfCode.Resources.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<IsAotCompatible>true</IsAotCompatible>
<OutputType>Library</OutputType>
<RootNamespace>MartinCostello.AdventOfCode</RootNamespace>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Input\**\input.txt" />
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode.Site/AdventOfCode.Site.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<OutputType>Exe</OutputType>
<PublishSelfContained>true</PublishSelfContained>
<RootNamespace>MartinCostello.AdventOfCode.Site</RootNamespace>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>latest</TypeScriptToolsVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode.Site/aws-lambda-tools-defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"region": "eu-west-2",
"profile": "",
"configuration": "Release",
"framework": "net10.0",
"framework": "net11.0",
"function-architecture": "arm64",
"function-description": "The Advent of Code as a Service function.",
"function-handler": "AdventOfCode.Site",
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/AdventOfCode.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<NoWarn>$(NoWarn);CA1034;CA2007;CA2225;CA5351</NoWarn>
<OutputType>Library</OutputType>
<RootNamespace>MartinCostello.AdventOfCode</RootNamespace>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.HighPerformance" />
Expand Down
4 changes: 2 additions & 2 deletions src/AdventOfCode/PuzzleResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public sealed class PuzzleResult
/// <summary>
/// Gets the solution(s) to the puzzle.
/// </summary>
public IList<object> Solutions { get; private set; } = new List<object>(2);
public IList<object> Solutions { get; private set; } = [with(2)];

/// <summary>
/// Gets the visualization(s) associated with the puzzle, if any.
/// </summary>
public IList<string> Visualizations { get; private set; } = new List<string>(2);
public IList<string> Visualizations { get; private set; } = [with(2)];

/// <summary>
/// Converts a puzzle result to a <see cref="Task{PuzzleResult}"/>.
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2015/Day06.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ internal LightGrid(int width, int height)
}

_bounds = new(0, 0, width, height);
_lightBrightnesses = new(width * height);
_lightBrightnesses = [with(width * height)];
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/AdventOfCode/Puzzles/Y2015/Day21.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,17 @@ private sealed class Shop
/// <summary>
/// The shop's current armor inventory. This field is read-only.
/// </summary>
private readonly Dictionary<string, Item> _armor = new(PotentialArmor);
private readonly Dictionary<string, Item> _armor = [with(PotentialArmor)];

/// <summary>
/// The shop's current ring inventory. This field is read-only.
/// </summary>
private readonly Dictionary<string, Item> _rings = new(PotentialRings);
private readonly Dictionary<string, Item> _rings = [with(PotentialRings)];

/// <summary>
/// The shop's current weapon inventory. This field is read-only.
/// </summary>
private readonly Dictionary<string, Item> _weapons = new(PotentialWeapons);
private readonly Dictionary<string, Item> _weapons = [with(PotentialWeapons)];

/// <summary>
/// Purchases the specified armor.
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2016/Day11.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override async Task<PuzzleResult> SolveCoreAsync(string[] args, Cancel
/// </returns>
private static Dictionary<int, List<Element>> ParseInitialState(IList<string> initialState)
{
Dictionary<int, List<Element>> state = new(4);
Dictionary<int, List<Element>> state = [with(4)];

for (int i = 0; i < initialState.Count; i++)
{
Expand Down
2 changes: 2 additions & 0 deletions src/AdventOfCode/Puzzles/Y2016/Day21.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ private static void SwapLetters(Span<char> values, string x, string y)
/// <param name="x">The index of the first location to swap.</param>
/// <param name="y">The index of the second location to swap.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#pragma warning disable CA1517 // HACK https://github.com/dotnet/sdk/issues/53388
private static void SwapPosition(Span<char> values, int x, int y)
#pragma warning disable CA1517
=> (values[x], values[y]) = (values[y], values[x]);
}
4 changes: 2 additions & 2 deletions src/AdventOfCode/Puzzles/Y2018/Day08.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ private sealed class Node(int childCount, int metadataCount)

public int MetadataCount { get; init; } = metadataCount;

public List<Node> Children { get; } = new(childCount);
public List<Node> Children { get; } = [with(childCount)];

public List<int> Metadata { get; } = new(metadataCount);
public List<int> Metadata { get; } = [with(metadataCount)];

public long MetadataSum { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2020/Day19.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static int GetMatchCount(IList<string> input, bool applyFix)

static Dictionary<string, string> ParseRules(IEnumerable<string> input, int count)
{
Dictionary<string, List<string>> rawRules = new(count);
Dictionary<string, List<string>> rawRules = [with(count)];

foreach (string rule in input)
{
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2021/Day11.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static (int Flashes100, int StepOfFirstSynchronizedFlash) Simulate(IList<

for (int i = 0; i < steps; i++)
{
current = new Dictionary<Point, int>(previous.Count);
current = [with(previous.Count)];

var pointsToFlash = new List<Point>();

Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2021/Day23.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public IEnumerable<State> Neighbors(State id)
continue;
}

int firstSpace = burrow.LastIndexOf(' ');
int firstSpace = burrow.LastIndexOf(' ', StringComparison.Ordinal);
string populated = Replace(burrow, amphipod, firstSpace);
string newHallway = Replace(id.Hallway, ' ', space);

Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2022/Day05.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static int GetStackCount(IList<string> instructions)
if (string.IsNullOrEmpty(instructions[i]))
{
string trimmed = instructions[i - 1].Trim();
return Parse<int>(trimmed[trimmed.LastIndexOf(' ')..]);
return Parse<int>(trimmed[trimmed.LastIndexOf(' ', StringComparison.Ordinal)..]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2022/Day07.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static int ParseEntries(Directory current, ReadOnlySpan<string> terminalOutput)
{
string item = terminalOutput[i];

if (item.StartsWith('$'))
if (item.StartsWith('$', StringComparison.Ordinal))
{
count = i;
break;
Expand Down
4 changes: 2 additions & 2 deletions src/AdventOfCode/Puzzles/Y2022/Day11.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static ICollection<Monkey> Parse(IList<string> observations, bool highAnxiety)

string operationString = operation[2..];

if (operation.StartsWith('+'))
if (operation.StartsWith('+', StringComparison.Ordinal))
{
if (operationString is "old")
{
Expand All @@ -92,7 +92,7 @@ static ICollection<Monkey> Parse(IList<string> observations, bool highAnxiety)
monkey.Inspector = (p) => p + operationValue;
}
}
else if (operation.StartsWith('*'))
else if (operation.StartsWith('*', StringComparison.Ordinal))
{
if (operationString is "old")
{
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2022/Day12.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private sealed class Map : SquareGrid
public Map(int width, int height)
: base(width, height)
{
Elevations = new(Width * Height);
Elevations = [with(Width * Height)];
}

public Point Start { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions src/AdventOfCode/Puzzles/Y2023/Day08.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public static long WalkNetwork(IList<string> nodes, bool asGhost, CancellationTo

if (asGhost)
{
destination = (p) => p.EndsWith('Z');
locations = [.. network.Edges.Keys.Where((p) => p.EndsWith('A'))];
destination = (p) => p.EndsWith('Z', StringComparison.Ordinal);
locations = [.. network.Edges.Keys.Where((p) => p.EndsWith('A', StringComparison.Ordinal))];
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2023/Day12.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public IEnumerable<State> Neighbors(State id)

yield return new State(next, id.Counts, id.Actual + 1, id.Desired);

i = springs.IndexOf(Unknown, i + 1);
i = springs.IndexOf(Unknown, i + 1, StringComparison.Ordinal);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2023/Day22.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static Vector3 ParseVector(ReadOnlySpan<char> value)

if (transform != Vector3.Zero)
{
transformed = new HashSet<Vector3>(cubes!.Length);
transformed = [with(cubes!.Length)];

for (int i = 0; i < cubes.Length; i++)
{
Expand Down
4 changes: 2 additions & 2 deletions src/AdventOfCode/Puzzles/Y2024/Day01.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public sealed class Day01 : Puzzle<int, int>
/// </returns>
public static (int TotalDistance, int SimilarityScore) ParseList(IList<string> values)
{
List<int> first = new(values.Count);
List<int> second = new(values.Count);
List<int> first = [with(values.Count)];
List<int> second = [with(values.Count)];

foreach (string pair in values)
{
Expand Down
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2024/Day10.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ protected override async Task<PuzzleResult> SolveCoreAsync(string[] args, Cancel

private sealed class TopographicMap(Rectangle bounds) : SquareGrid(bounds)
{
public Dictionary<Point, int> Heights { get; } = new(bounds.Area());
public Dictionary<Point, int> Heights { get; } = [with(bounds.Area())];
}
}
2 changes: 1 addition & 1 deletion src/AdventOfCode/Puzzles/Y2025/Day12.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public HashSet<Point> Empty()

private sealed class Shape(int index, int capacity) : HashSet<Point>(capacity)
{
private readonly List<Shape> _transformations = new(8);
private readonly List<Shape> _transformations = [with(8)];

public int Index { get; } = index;

Expand Down
2 changes: 1 addition & 1 deletion startvscode.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SET DOTNET_ROOT(x86)=%~dp0.dotnet\x86
SET PATH=%DOTNET_ROOT%;%PATH%

:: Sets the Target Framework for Visual Studio Code.
SET TARGET=net10.0
SET TARGET=net11.0

SET FOLDER=%~1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<NoWarn>$(NoWarn);CA1034;CA1056;CA1819;CA2007;SA1600</NoWarn>
<OutputType>Exe</OutputType>
<RootNamespace>MartinCostello.AdventOfCode.Benchmarks</RootNamespace>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\AdventOfCode\AdventOfCode.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion tests/AdventOfCode.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
using BenchmarkDotNet.Running;
using MartinCostello.AdventOfCode.Benchmarks;

var summary = BenchmarkRunner.Run<PuzzleBenchmarks>(args: args);
var summary = await BenchmarkRunner.RunAsync<PuzzleBenchmarks>(args: args);
return summary.Reports.Any((p) => !p.Success) ? 1 : 0;
2 changes: 1 addition & 1 deletion tests/AdventOfCode.Tests/AdventOfCode.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<NoWarn>$(NoWarn);xUnit1004</NoWarn>
<OutputType>Exe</OutputType>
<RootNamespace>MartinCostello.AdventOfCode</RootNamespace>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<UseDefaultCodeAnalysisRuleSet>true</UseDefaultCodeAnalysisRuleSet>
<UseLocalDevelopmentCertificate>true</UseLocalDevelopmentCertificate>
</PropertyGroup>
Expand Down
Loading