Skip to content

Commit

Permalink
Don't allocate a new object when constructing an empty Metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeyde-varada authored and sopel39 committed Nov 25, 2021
1 parent 9a824be commit b47e6b8
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ private static Metric<?> merge(Metric<?> a, Metric<?> b)

public Metrics get()
{
if (merged.isEmpty()) {
return EMPTY;
}
return new Metrics(merged);
}
}
Expand Down

0 comments on commit b47e6b8

Please sign in to comment.