Skip to content

Commit

Permalink
optimize Props NewExpression allocations (akkadotnet#5428)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb committed Dec 20, 2021
1 parent 0b58a21 commit 3be45c9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/core/Akka/Actor/Props.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ public static Props Create<TActor>(Expression<Func<TActor>> factory,
var newExpression = factory.Body as NewExpression
?? throw new ArgumentException("The create function must be a 'new T (args)' expression");

var args = newExpression.GetArguments();
args = args.Length > 0 ? args : NoArgs;
var args = newExpression.Arguments.Count > 0 ? newExpression.GetArguments() : NoArgs;

return new Props(ActivatorProducer.Instance, DefaultDeploy, typeof(TActor), args) { SupervisorStrategy = supervisorStrategy };
}
Expand Down

0 comments on commit 3be45c9

Please sign in to comment.