Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added real UID to ActorPathBenchmarks #6276

Merged
merged 2 commits into from
Nov 29, 2022

Conversation

Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Nov 29, 2022

Changes

While working on #6195 I realized that none of those ActorPaths actually have a set UID, thus we're missing that entire facet from both the parsing and serialization benchmarks.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Latest v1.4 Benchmarks

BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19044.2251 (21H2)
AMD Ryzen 7 1700, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.100
  [Host]     : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT
  DefaultJob : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT

Method Uid Mean Error StdDev Gen 0 Allocated
ActorPath_Parse 1 268.316 ns 1.5227 ns 1.2715 ns 0.0992 416 B
ActorPath_Concat 1 38.400 ns 0.1241 ns 0.1036 ns 0.0268 112 B
ActorPath_Equals 1 4.377 ns 0.0361 ns 0.0320 ns - -
ActorPath_ToString 1 50.872 ns 0.1519 ns 0.1269 ns 0.0268 112 B
ActorPath_ToSerializationFormat 1 168.876 ns 1.6593 ns 1.4709 ns 0.0610 256 B
ActorPath_ToSerializationFormatWithAddress 1 168.242 ns 2.5289 ns 2.1117 ns 0.0610 256 B
ActorPath_Parse 100000 281.081 ns 1.4482 ns 1.2838 ns 0.0992 416 B
ActorPath_Concat 100000 38.480 ns 0.1676 ns 0.1309 ns 0.0268 112 B
ActorPath_Equals 100000 4.377 ns 0.0479 ns 0.0425 ns - -
ActorPath_ToString 100000 50.507 ns 0.1441 ns 0.1203 ns 0.0268 112 B
ActorPath_ToSerializationFormat 100000 180.087 ns 0.3269 ns 0.2552 ns 0.0629 264 B
ActorPath_ToSerializationFormatWithAddress 100000 185.135 ns 3.4828 ns 3.0874 ns 0.0629 264 B
ActorPath_Parse 2147483647 300.098 ns 3.0413 ns 2.6960 ns 0.0992 416 B
ActorPath_Concat 2147483647 39.325 ns 0.8076 ns 0.7159 ns 0.0268 112 B
ActorPath_Equals 2147483647 4.360 ns 0.0337 ns 0.0315 ns - -
ActorPath_ToString 2147483647 51.842 ns 1.0444 ns 1.0725 ns 0.0268 112 B
ActorPath_ToSerializationFormat 2147483647 193.560 ns 2.6633 ns 2.2240 ns 0.0648 272 B
ActorPath_ToSerializationFormatWithAddress 2147483647 194.647 ns 3.9673 ns 6.1767 ns 0.0648 272 B

While working on akkadotnet#6195 I realized that none of those `ActorPath`s actually have a set UID, thus we're missing that entire facet from both the parsing and serialization benchmarks.
@Aaronontheweb Aaronontheweb added perf akka.net v1.4 Issues affecting Akka.NET v1.4 labels Nov 29, 2022
Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll notice that the parsing and serialization overhead increase linearly with the size of the UID - this indicates to me that we're now correctly factoring it into our benchmarks whereas we were not doing this properly before.

private string _actorPathStr;

[Params(1, 100000, int.MaxValue)]
public int Uid { get; set; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameterize the UID using increasing lengths - int.MaxValue is the upper limit of what the UID function will produce in v1.4:

private static long NewUid()
{
// Note that this uid is also used as hashCode in ActorRef, so be careful
// to not break hashing if you change the way uid is generated
var uid = ThreadLocalRandom.Current.Next();
while (uid == UndefinedUid)
uid = ThreadLocalRandom.Current.Next();
return uid;
}

_childPath = x / "parent" / "child";
var parentPath = x / "parent";
_childPath = new ChildActorPath(parentPath, "child", Uid);
_actorPathStr = _childPath.ToSerializationFormat();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have the string we parse be produced by the absolute path of the ChildActorPath we use for the other tests, including the UID.

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) November 29, 2022 11:59
@Aaronontheweb Aaronontheweb merged commit bb7435e into akkadotnet:v1.4 Nov 29, 2022
@Aaronontheweb Aaronontheweb deleted the actorpath-benchmarks-uid branch November 29, 2022 16:08
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this pull request Nov 30, 2022
While working on akkadotnet#6195 I realized that none of those `ActorPath`s actually have a set UID, thus we're missing that entire facet from both the parsing and serialization benchmarks.
Aaronontheweb added a commit that referenced this pull request Dec 1, 2022
* cleaned up duplicate System.Collections.Immutable package reference (#6264)

also standardized all System.* packages on a common version

* converted build system to .NET 7.0 (#6263)

* converted build system to .NET 7.0

* upgrade to Incrementalist.Cmd v0.8.0

* upgraded MNTR to support .NET 7.0

* fixed build system to target .NET 7.0

* upgrade to latest version of DocFx

* add .NET 6 SDK back to build system

* fixed HyperionConfigTests

* Akka.Streams: `ReuseLatest` stage to repeatedly emit the most recent value until a newer one is pushed (#6262)

* code cleanup in Akka.Streams `Attributes`

* added `RepeatPrevious{T}` stage

* WIP - debugging `RepeatPreviousSpecs`

* fixed tests and added documentation

* fixed documentation

* API approvals

* fixed markdown linting

* removed `SwapPrevious<T>` delegate.

* renamed stage from `RepeatPrevious` to `ReuseLatest`

* remove BDN results

* added real UID to `ActorPathBenchmarks` (#6276)

While working on #6195 I realized that none of those `ActorPath`s actually have a set UID, thus we're missing that entire facet from both the parsing and serialization benchmarks.

* Enable dynamic PGO for RemotePingPong and PingPong (#6277)

* 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

* compilation fixes and V1.5 api approval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
akka.net v1.4 Issues affecting Akka.NET v1.4 perf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant