Skip to content

Commit 335dffb

Browse files
authored
Merge branch 'main' into update-target-frameworks
2 parents 689d26c + db9f9e7 commit 335dffb

File tree

10 files changed

+76
-74
lines changed

10 files changed

+76
-74
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v3
41+
uses: actions/checkout@v4
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
45+
uses: github/codeql-action/init@v3
4646
with:
4747
languages: ${{ matrix.language }}
4848
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -52,8 +52,8 @@ jobs:
5252

5353
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5454
# If this step fails, then you should remove it and run the build manually (see below)
55-
- name: Autobuild
56-
uses: github/codeql-action/autobuild@v2
55+
#- name: Autobuild
56+
# uses: github/codeql-action/autobuild@v3
5757

5858
# ℹ️ Command-line programs to run using the OS shell.
5959
# 📚 https://git.io/JvXDl
@@ -65,6 +65,16 @@ jobs:
6565
#- run: |
6666
# make bootstrap
6767
# make release
68+
- name: Setup .NET SDK
69+
uses: actions/setup-dotnet@v4
70+
with:
71+
dotnet-version: '9.0.x'
72+
73+
- name: Restore dependencies
74+
run: dotnet restore
75+
76+
- name: Build
77+
run: dotnet build --configuration Debug --no-restore
6878

6979
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@v2
80+
uses: github/codeql-action/analyze@v3

.github/workflows/gate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
3.1.x
2525
6.0.x
2626
8.0.x
27+
9.0.x
2728
- name: Install dependencies
2829
run: dotnet restore
2930
- name: Build
@@ -98,6 +99,7 @@ jobs:
9899
dotnet-version: |
99100
6.0.x
100101
8.0.x
102+
9.0.x
101103
- name: Install dependencies
102104
run: dotnet restore
103105
- name: Build
@@ -139,6 +141,7 @@ jobs:
139141
dotnet-version: |
140142
6.0.x
141143
8.0.x
144+
9.0.x
142145
- name: Install dependencies
143146
run: dotnet restore
144147
- name: Build

.github/workflows/infer.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- name: Setup .NET Core
19-
uses: actions/setup-dotnet@v2
19+
uses: actions/setup-dotnet@v4
2020
with:
21-
dotnet-version: 8.0.x
21+
dotnet-version: 9.0.x
2222
- name: Install dependencies
2323
run: dotnet restore
2424
- name: Build
2525
run: dotnet build --configuration Release --no-restore
2626

2727
- name: Run Infer#
28-
uses: microsoft/infersharpaction@v1.4
28+
uses: microsoft/infersharpaction@v1.5
2929
id: runinfersharp
3030
with:
3131
binary-path: BitFaster.Caching/bin

BitFaster.Caching.Benchmarks/BitFaster.Caching.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
2727
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.14.0" />
2828
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
29-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
29+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.2" />
3030
<PackageReference Include="System.Runtime.Caching" Version="8.0.1" />
3131
</ItemGroup>
3232

BitFaster.Caching.HitRateAnalysis/BitFaster.Caching.HitRateAnalysis.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3232
</PackageReference>
3333
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
34-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
34+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.2" />
3535
<PackageReference Include="Plotly.NET.CSharp" Version="0.13.0" />
3636
<PackageReference Include="Plotly.NET.ImageExport" Version="6.1.0" />
3737
</ItemGroup>

BitFaster.Caching.ThroughputAnalysis/BitFaster.Caching.ThroughputAnalysis.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PrivateAssets>all</PrivateAssets>
2727
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2828
</PackageReference>
29-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
29+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.2" />
3030
<PackageReference Include="Plotly.NET" Version="5.1.0" />
3131
<PackageReference Include="Plotly.NET.ImageExport" Version="6.1.0" />
3232
</ItemGroup>

BitFaster.Caching/Intrinsics.cs

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
#if NET
1+
#if NET
22
using System.Runtime.Intrinsics.X86;
33
using System.Runtime.Intrinsics.Arm;
4-
#endif
5-
6-
namespace BitFaster.Caching
7-
{
8-
/// <summary>
9-
/// Represents a marker interface to enable instruction set hardware intrinsics.
10-
/// </summary>
11-
public interface IsaProbe
12-
{
13-
/// <summary>
14-
/// Gets a value indicating whether AVX2 is supported.
15-
/// </summary>
4+
#endif
5+
6+
namespace BitFaster.Caching
7+
{
8+
/// <summary>
9+
/// Represents a marker interface to enable instruction set hardware intrinsics.
10+
/// </summary>
11+
public interface IsaProbe
12+
{
13+
/// <summary>
14+
/// Gets a value indicating whether AVX2 is supported.
15+
/// </summary>
1616
bool IsAvx2Supported { get; }
1717

1818
#if NET
19-
/// <summary>
20-
/// Gets a value indicating whether Arm64 is supported.
21-
/// </summary>
22-
bool IsArm64Supported { get => false; }
23-
#endif
24-
}
25-
26-
/// <summary>
27-
/// Detect support for hardware instructions via intrinsics.
28-
/// </summary>
29-
public readonly struct DetectIsa : IsaProbe
30-
{
31-
#if NET
32-
/// <inheritdoc/>
33-
public bool IsAvx2Supported => Avx2.IsSupported;
34-
#else
35-
/// <inheritdoc/>
19+
/// <summary>
20+
/// Gets a value indicating whether Arm64 is supported.
21+
/// </summary>
22+
bool IsArm64Supported { get => false; }
23+
#endif
24+
}
25+
26+
/// <summary>
27+
/// Detect support for hardware instructions via intrinsics.
28+
/// </summary>
29+
public readonly struct DetectIsa : IsaProbe
30+
{
31+
#if NET
32+
/// <inheritdoc/>
33+
public bool IsAvx2Supported => Avx2.IsSupported;
34+
#else
35+
/// <inheritdoc/>
3636
public bool IsAvx2Supported => false;
37-
#endif
38-
37+
#endif
38+
3939
#if NET
4040
/// <inheritdoc/>
4141
public bool IsArm64Supported => AdvSimd.Arm64.IsSupported;
4242
#else
4343
/// <inheritdoc/>
4444
public bool IsArm64Supported => false;
45-
#endif
46-
}
47-
48-
/// <summary>
49-
/// Force disable hardware instructions via intrinsics.
50-
/// </summary>
51-
public readonly struct DisableHardwareIntrinsics : IsaProbe
52-
{
53-
/// <inheritdoc/>
45+
#endif
46+
}
47+
48+
/// <summary>
49+
/// Force disable hardware instructions via intrinsics.
50+
/// </summary>
51+
public readonly struct DisableHardwareIntrinsics : IsaProbe
52+
{
53+
/// <inheritdoc/>
5454
public bool IsAvx2Supported => false;
5555

5656
/// <inheritdoc/>
57-
public bool IsArm64Supported => false;
58-
}
59-
}
57+
public bool IsArm64Supported => false;
58+
}
59+
}

BitFaster.Caching/Lru/Defaults.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ namespace BitFaster.Caching.Lru
66
{
77
internal static class Defaults
88
{
9-
public static int ConcurrencyLevel
10-
{
11-
get { return Environment.ProcessorCount; }
12-
}
13-
14-
public static readonly TimeSpan Infinite = new(0, 0, 0, 0, -1);
9+
public static int ConcurrencyLevel => Environment.ProcessorCount;
1510
}
1611
}

BitFaster.Caching/Lru/EqualCapacityPartition.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,23 @@ namespace BitFaster.Caching.Lru
99
[DebuggerDisplay("{Hot}/{Warm}/{Cold}")]
1010
public class EqualCapacityPartition : ICapacityPartition
1111
{
12-
private readonly int hotCapacity;
13-
private readonly int warmCapacity;
14-
private readonly int coldCapacity;
15-
1612
/// <summary>
1713
/// Initializes a new instance of the EqualCapacityPartition class with the specified total capacity.
1814
/// </summary>
1915
/// <param name="totalCapacity">The total capacity.</param>
2016
public EqualCapacityPartition(int totalCapacity)
2117
{
22-
var (hot, warm, cold) = ComputeQueueCapacity(totalCapacity);
23-
this.hotCapacity = hot;
24-
this.warmCapacity = warm;
25-
this.coldCapacity = cold;
18+
(Hot, Warm, Cold) = ComputeQueueCapacity(totalCapacity);
2619
}
2720

2821
///<inheritdoc/>
29-
public int Cold => this.coldCapacity;
22+
public int Cold { get; }
3023

3124
///<inheritdoc/>
32-
public int Warm => this.warmCapacity;
25+
public int Warm { get; }
3326

3427
///<inheritdoc/>
35-
public int Hot => this.hotCapacity;
28+
public int Hot { get; }
3629

3730
private static (int hot, int warm, int cold) ComputeQueueCapacity(int capacity)
3831
{

BitFaster.Caching/Lru/LruPolicy.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Runtime.CompilerServices;
3+
using System.Threading;
34

45
namespace BitFaster.Caching.Lru
56
{
@@ -10,7 +11,7 @@ namespace BitFaster.Caching.Lru
1011
where K : notnull
1112
{
1213
///<inheritdoc/>
13-
public TimeSpan TimeToLive => Defaults.Infinite;
14+
public TimeSpan TimeToLive => Timeout.InfiniteTimeSpan;
1415

1516
///<inheritdoc/>
1617
[MethodImpl(MethodImplOptions.AggressiveInlining)]

0 commit comments

Comments
 (0)