-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eliminate
ActorPath.ToSerializationFormat
UID allocations (#6195)
* eliminate `ActorPath.ToSerializationFormat` UID allocations Used some more `Span<char>` magic to avoid additional allocations when string-ifying `ActorPath` components. * adding `SpanHacks` benchmarks * sped up `Int64SizeInCharacters` * added `TryFormat` benchmarks * fixed n+1 error in jump table * cleaned up `TryFormat` inside `SpanHacks` * fixed `SpanHacks` index calculation * removed BDN results * Update SpanHacks.cs
- Loading branch information
1 parent
b17ce60
commit 37179fe
Showing
6 changed files
with
184 additions
and
15 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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// //----------------------------------------------------------------------- | ||
// <copyright file="SpanHackBenchmarks.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2009-2022 Lightbend Inc. <http://www.lightbend.com> | ||
// Copyright (C) 2013-2022 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
using System; | ||
using Akka.Benchmarks.Configurations; | ||
using Akka.Util; | ||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace Akka.Benchmarks.Utils | ||
{ | ||
[Config(typeof(MicroBenchmarkConfig))] | ||
public class SpanHackBenchmarks | ||
{ | ||
[Params(0, 1, -1, 1000, int.MaxValue, long.MaxValue)] | ||
public long Formatted { get; set; } | ||
|
||
[Benchmark] | ||
public int Int64CharCountBenchmark() | ||
{ | ||
return SpanHacks.Int64SizeInCharacters(Formatted); | ||
} | ||
|
||
[Benchmark] | ||
public int TryFormatBenchmark() | ||
{ | ||
Span<char> buffer = stackalloc char[22]; | ||
return SpanHacks.TryFormat(Formatted, 0, ref buffer); | ||
} | ||
} | ||
} |
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
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