Skip to content

Commit

Permalink
Remove extra digest copy during Digest merge
Browse files Browse the repository at this point in the history
  • Loading branch information
sopel39 committed Mar 22, 2023
1 parent 1e5774d commit c001664
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,15 @@ public synchronized TDigest getDigest()
public TDigestHistogram mergeWith(TDigestHistogram other)
{
TDigest result = getDigest();
result.mergeWith(other.getDigest());
other.mergeTo(result);
return new TDigestHistogram(result);
}

private synchronized void mergeTo(TDigest digest)
{
digest.mergeWith(this.digest);
}

@Override
@JsonProperty
public synchronized long getTotal()
Expand Down

0 comments on commit c001664

Please sign in to comment.