File tree 1 file changed +51
-0
lines changed
src/benchmark/Akka.Benchmarks/Actor
1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ //-----------------------------------------------------------------------
2
+ // <copyright file="ActorMemoryFootprintBenchmarks.cs" company="Akka.NET Project">
3
+ // Copyright (C) 2009-2021 Lightbend Inc. <http://www.lightbend.com>
4
+ // Copyright (C) 2013-2021 .NET Foundation <https://github.com/akkadotnet/akka.net>
5
+ // </copyright>
6
+ //-----------------------------------------------------------------------
7
+
8
+ using System ;
9
+ using System . Collections . Generic ;
10
+ using System . Text ;
11
+ using System . Threading . Tasks ;
12
+ using Akka . Actor ;
13
+ using Akka . Benchmarks . Configurations ;
14
+ using BenchmarkDotNet . Attributes ;
15
+
16
+ namespace Akka . Benchmarks . Actor
17
+ {
18
+ [ Config ( typeof ( MicroBenchmarkConfig ) ) ]
19
+ public class ActorMemoryFootprintBenchmark
20
+ {
21
+ public ActorSystem Sys ;
22
+ public Props Props ;
23
+
24
+ [ GlobalSetup ]
25
+ public void Setup ( )
26
+ {
27
+ Sys = ActorSystem . Create ( "Bench" ) ;
28
+ Props = Props . Create ( ( ) => new TempActor ( ) ) ;
29
+ }
30
+
31
+ private class TempActor : UntypedActor
32
+ {
33
+ protected override void OnReceive ( object message )
34
+ {
35
+
36
+ }
37
+ }
38
+
39
+ [ Benchmark ]
40
+ public void SpawnActor ( )
41
+ {
42
+ Sys . ActorOf ( Props ) ;
43
+ }
44
+
45
+ [ GlobalCleanup ]
46
+ public async Task Cleanup ( )
47
+ {
48
+ await Sys . Terminate ( ) ;
49
+ }
50
+ }
51
+ }
You can’t perform that action at this time.
0 commit comments