-
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.
Merge pull request #5275 from akkadotnet/dev
Akka.NET v1.4.25 Release
- Loading branch information
Showing
73 changed files
with
2,090 additions
and
530 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
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,67 @@ | ||
// //----------------------------------------------------------------------- | ||
// // <copyright file="ActorRefBenchmarks.cs" company="Akka.NET Project"> | ||
// // Copyright (C) 2009-2021 Lightbend Inc. <http://www.lightbend.com> | ||
// // Copyright (C) 2013-2021 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// // </copyright> | ||
// //----------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using Akka.Actor; | ||
using Akka.Benchmarks.Configurations; | ||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace Akka.Benchmarks.Actor | ||
{ | ||
[Config(typeof(MicroBenchmarkConfig))] // need memory diagnosis | ||
public class ActorRefBenchmarks | ||
{ | ||
[Params(10000)] | ||
public int Iterations { get; set; } | ||
private TimeSpan _timeout; | ||
private ActorSystem _system; | ||
private IActorRef _echo; | ||
private IActorRef _echo2; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
_timeout = TimeSpan.FromMinutes(1); | ||
_system = ActorSystem.Create("system"); | ||
_echo = _system.ActorOf(Props.Create(() => new EchoActor()), "echo"); | ||
_echo2 = _system.ActorOf(Props.Create(() => new EchoActor()), "echo2"); | ||
} | ||
|
||
[Benchmark] | ||
public int ActorRefGetHashCode() | ||
{ | ||
return _echo.GetHashCode(); | ||
} | ||
|
||
[Benchmark] | ||
public bool ActorRefEqualsSelf() | ||
{ | ||
return _echo.Equals(_echo); | ||
} | ||
|
||
[Benchmark] | ||
public bool ActorRefEqualsSomeoneElse() | ||
{ | ||
return _echo.Equals(_echo2); | ||
} | ||
|
||
[GlobalCleanup] | ||
public void Cleanup() | ||
{ | ||
_system.Terminate().Wait(); | ||
} | ||
|
||
public class EchoActor : UntypedActor | ||
{ | ||
protected override void OnReceive(object message) | ||
{ | ||
Sender.Tell(message); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.