-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor runtime optimizations and code readability improvements
- Loading branch information
Showing
8 changed files
with
137 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<Version>0.73.0</Version> | ||
<Version>0.73.1</Version> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2023, Olaf Kober <[email protected]> | ||
// Copyright (c) 2024, Olaf Kober <[email protected]> | ||
|
||
#pragma warning disable CA1822 // Mark members as static | ||
|
||
|
@@ -32,7 +32,6 @@ AnyValue value | |
AnyValue.ValuesOneofCase.Uint32 => value.Uint32, | ||
AnyValue.ValuesOneofCase.Uint64 => value.Uint64, | ||
AnyValue.ValuesOneofCase.Decimal => _DeserializeDecimal(value.Decimal), | ||
AnyValue.ValuesOneofCase.None => throw _MakeUnexpectedCaseException(value.ValuesCase), | ||
_ => throw _MakeUnexpectedCaseException(value.ValuesCase), | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,25 @@ | ||
// Copyright (c) 2023, Olaf Kober <[email protected]> | ||
// Copyright (c) 2024, Olaf Kober <[email protected]> | ||
|
||
namespace Amarok.Diagnostics.Persistence.Tracing.Reader.Internal; | ||
|
||
|
||
internal abstract class InterningMapBase<T> | ||
where T : class | ||
{ | ||
private readonly Int32 mCapacity; | ||
|
||
private T?[] mArray; | ||
|
||
|
||
protected InterningMapBase( | ||
Int32 capacity | ||
) | ||
{ | ||
mCapacity = capacity; | ||
mArray = new T[capacity]; | ||
} | ||
|
||
|
||
public void Reset() | ||
{ | ||
mArray = new T[mCapacity]; | ||
Array.Clear(mArray, 0, mArray.Length); | ||
} | ||
|
||
|
||
|
@@ -34,10 +31,9 @@ T item | |
if (id >= mArray.Length) | ||
{ | ||
_ResizeTo(id); | ||
|
||
mArray[id] = item; | ||
} | ||
else if (mArray[id] == null) | ||
|
||
if (mArray[id] == null) | ||
{ | ||
mArray[id] = item; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// Copyright (c) 2024, Olaf Kober <[email protected]> | ||
|
||
using System.Buffers; | ||
using System.Buffers.Binary; | ||
using System.Diagnostics; | ||
using System.IO.Compression; | ||
|
@@ -283,7 +284,7 @@ String filePath | |
|
||
using (var compressed = new DeflateStream(target, CompressionLevel.Fastest)) | ||
{ | ||
var bytes = new Byte[8192]; | ||
var bytes = ArrayPool<Byte>.Shared.Rent(8192); | ||
|
||
while (true) | ||
{ | ||
|
@@ -296,6 +297,8 @@ String filePath | |
|
||
compressed.Write(bytes, 0, read); | ||
} | ||
|
||
ArrayPool<Byte>.Shared.Return(bytes); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.