Skip to content

Commit

Permalink
optimize Props NewExpression allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb committed Dec 14, 2021
1 parent 12c26c2 commit b4f107c
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 b4f107c

Please sign in to comment.