Skip to content

Commit b7cd571

Browse files
author
LinkDotNet Bot
committed
Updating to newest release
2 parents 03498e4 + a582563 commit b7cd571

File tree

9 files changed

+44
-21
lines changed

9 files changed

+44
-21
lines changed

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222

2323
steps:
2424
- name: Checkout repository
25-
uses: actions/checkout@v4.1.7
25+
uses: actions/checkout@v4.2.2
2626

27-
- uses: actions/setup-dotnet@v4.0.1
27+
- uses: actions/setup-dotnet@v4.1.0
2828
with:
2929
dotnet-version: |
3030
6.0.x

.github/workflows/create-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121

2222
- name: Checkout repository
23-
uses: actions/checkout@v4.1.7
23+
uses: actions/checkout@v4.2.2
2424
with:
2525
token: ${{ secrets.SBPAT }}
2626
persist-credentials: true
@@ -34,7 +34,7 @@ jobs:
3434
path: ./CHANGELOG.md
3535

3636
- name: Setup dotnet
37-
uses: actions/setup-dotnet@v4.0.1
37+
uses: actions/setup-dotnet@v4.1.0
3838
with:
3939
dotnet-version: |
4040
6.0.x

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
runs-on: windows-latest
1313

1414
steps:
15-
- uses: actions/checkout@v4.1.7
15+
- uses: actions/checkout@v4.2.2
1616

1717
- name: Setup .NET
18-
uses: actions/setup-dotnet@v4.0.1
18+
uses: actions/setup-dotnet@v4.1.0
1919
with:
2020
dotnet-version: |
2121
6.0.x
@@ -24,7 +24,7 @@ jobs:
2424
9.0.x
2525
2626
- name: Setup DocFX
27-
uses: crazy-max/ghaction-chocolatey@v3.0.0
27+
uses: crazy-max/ghaction-chocolatey@v3.2.0
2828
with:
2929
args: install docfx
3030

.github/workflows/dotnet.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/checkout@v4.1.7
15+
- uses: actions/checkout@v4.2.2
1616
- name: Setup .NET
17-
uses: actions/setup-dotnet@v4.0.1
17+
uses: actions/setup-dotnet@v4.1.0
1818
with:
1919
dotnet-version: |
2020
6.0.x

.github/workflows/update-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Checkout repository
16-
uses: actions/checkout@v4.1.7
16+
uses: actions/checkout@v4.2.2
1717
with:
1818
token: ${{ secrets.SBPAT }}
1919
persist-credentials: false

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ All notable changes to **ValueStringBuilder** will be documented in this file. T
66

77
## [Unreleased]
88

9+
## [1.21.1] - 2024-11-08
10+
11+
### Changed
12+
13+
- `Append(bool)` is now 33% faster
14+
915
## [1.21.0] - 2024-09-20
1016

1117
### Added
@@ -406,7 +412,8 @@ This release brings extensions to the `ValueStringBuilder` API. For `v1.0` the `
406412

407413
- Initial release
408414

409-
[unreleased]: https://github.com/linkdotnet/StringBuilder/compare/1.21.0...HEAD
415+
[unreleased]: https://github.com/linkdotnet/StringBuilder/compare/1.21.1...HEAD
416+
[1.21.1]: https://github.com/linkdotnet/StringBuilder/compare/1.21.0...1.21.1
410417
[1.21.0]: https://github.com/linkdotnet/StringBuilder/compare/1.20.0...1.21.0
411418
[1.20.0]: https://github.com/linkdotnet/StringBuilder/compare/1.19.1...1.20.0
412419
[1.19.1]: https://github.com/linkdotnet/StringBuilder/compare/1.19.0...1.19.1

src/LinkDotNet.StringBuilder/LinkDotNet.StringBuilder.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</PropertyGroup>
4141

4242
<ItemGroup>
43-
<PackageReference Include="Meziantou.Analyzer" Version="2.0.163">
43+
<PackageReference Include="Meziantou.Analyzer" Version="2.0.177">
4444
<PrivateAssets>all</PrivateAssets>
4545
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4646
</PackageReference>

src/LinkDotNet.StringBuilder/ValueStringBuilder.Append.cs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,38 @@ public ref partial struct ValueStringBuilder
1010
/// </summary>
1111
/// <param name="value">Bool value to add.</param>
1212
[MethodImpl(MethodImplOptions.AggressiveInlining)]
13-
public void Append(bool value)
13+
public unsafe void Append(bool value)
1414
{
15-
// 5 is the length of the string "False"
16-
// So we can check if we have enough space in the buffer
17-
var newSize = bufferPosition + 5;
15+
const int trueLength = 4;
16+
const int falseLength = 5;
17+
18+
var newSize = bufferPosition + falseLength;
19+
1820
if (newSize > buffer.Length)
1921
{
2022
Grow(newSize);
2123
}
2224

23-
if (!value.TryFormat(buffer[bufferPosition..], out var charsWritten))
25+
fixed (char* dest = &buffer[bufferPosition])
2426
{
25-
throw new InvalidOperationException($"Could not add {value} to the builder.");
27+
if (value)
28+
{
29+
*(dest + 0) = 'T';
30+
*(dest + 1) = 'r';
31+
*(dest + 2) = 'u';
32+
*(dest + 3) = 'e';
33+
bufferPosition += trueLength;
34+
}
35+
else
36+
{
37+
*(dest + 0) = 'F';
38+
*(dest + 1) = 'a';
39+
*(dest + 2) = 'l';
40+
*(dest + 3) = 's';
41+
*(dest + 4) = 'e';
42+
bufferPosition += falseLength;
43+
}
2644
}
27-
28-
bufferPosition += charsWritten;
2945
}
3046

3147
/// <summary>

tests/LinkDotNet.StringBuilder.UnitTests/LinkDotNet.StringBuilder.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<ItemGroup>
1111
<PackageReference Include="FluentAssertions" Version="6.12.1" />
1212
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
13-
<PackageReference Include="xunit" Version="2.9.0" />
13+
<PackageReference Include="xunit" Version="2.9.2" />
1414
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
<PrivateAssets>all</PrivateAssets>

0 commit comments

Comments
 (0)