-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Improve performance on IActorRef.Child
API
#5242
Changes from 16 commits
9a50416
0aa7122
bf6e162
fdac3b9
bc91ad8
d754014
3910d11
f8f5342
3197d0c
6b590d7
8cce9b7
16e33c8
702d7b8
26db634
bc66127
075159b
d04e5a7
9f8b852
83224be
60b3537
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,11 +156,9 @@ protected override void TellInternal(object message, IActorRef sender) | |
} | ||
} | ||
|
||
var t = Rec(ImmutableList<string>.Empty); | ||
var concatenatedChildNames = t.Item1; | ||
var m = t.Item2; | ||
var (concatenatedChildNames, m) = Rec(ImmutableList<string>.Empty); | ||
|
||
var child = GetChild(concatenatedChildNames); | ||
var child = GetChild(concatenatedChildNames.ToList()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra allocation in remote deployments here.... might see if I can go about fixing that still.... |
||
if (child.IsNobody()) | ||
{ | ||
var emptyRef = new EmptyLocalActorRef(_system.Provider, | ||
|
@@ -302,7 +300,7 @@ private void HandleDaemonMsgCreate(DaemonMsgCreate message) | |
/// </summary> | ||
/// <param name="name">The name.</param> | ||
/// <returns>ActorRef.</returns> | ||
public override IActorRef GetChild(IEnumerable<string> name) | ||
public override IActorRef GetChild(IReadOnlyList<string> name) | ||
{ | ||
var path = name.Join("/"); | ||
var n = 0; | ||
|
@@ -313,7 +311,7 @@ public override IActorRef GetChild(IEnumerable<string> name) | |
{ | ||
if (uid != ActorCell.UndefinedUid && uid != child.Path.Uid) | ||
return Nobody.Instance; | ||
return n == 0 ? child : child.GetChild(name.TakeRight(n)); | ||
return n == 0 ? child : child.GetChild(name.TakeRight(n).ToList()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another allocation in remote deployments |
||
} | ||
|
||
var last = path.LastIndexOf("/", StringComparison.Ordinal); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,8 +265,7 @@ protected void SetTerminated() | |
{ | ||
get | ||
{ | ||
var terminating = ChildrenContainer as TerminatingChildrenContainer; | ||
return terminating != null && terminating.Reason is SuspendReason.IWaitingForChildren; | ||
return ChildrenContainer is TerminatingChildrenContainer terminating && terminating.Reason is SuspendReason.IWaitingForChildren; | ||
} | ||
} | ||
|
||
|
@@ -325,8 +324,7 @@ public bool TryGetChildStatsByName(string name, out IChildStats child) //This | |
/// </summary> | ||
private bool TryGetChildRestartStatsByName(string name, out ChildRestartStats child) | ||
{ | ||
IChildStats stats; | ||
if (ChildrenContainer.TryGetByName(name, out stats)) | ||
if (ChildrenContainer.TryGetByName(name, out var stats)) | ||
{ | ||
child = stats as ChildRestartStats; | ||
if (child != null) | ||
|
@@ -358,10 +356,11 @@ protected bool TryGetChildStatsByRef(IActorRef actor, out ChildRestartStats chil | |
[Obsolete("Use TryGetSingleChild [0.7.1]")] | ||
public IInternalActorRef GetSingleChild(string name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Half the perf optimizations happened here:
|
||
{ | ||
IInternalActorRef child; | ||
return TryGetSingleChild(name, out child) ? child : ActorRefs.Nobody; | ||
return TryGetSingleChild(name, out var child) ? child : ActorRefs.Nobody; | ||
} | ||
|
||
|
||
|
||
/// <summary> | ||
/// TBD | ||
/// </summary> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Source-compatible, but not necessarily a binary-compatible change.