Skip to content

Commit 979b34f

Browse files
committed
Small perf improvement
1 parent afc7bc5 commit 979b34f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/lib/opentelemetry/trace/tracestate.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def create(hash)
7575
# @return [Tracestate]
7676
def initialize(hash)
7777
excess = hash.size - MAX_MEMBER_COUNT
78-
hash = Hash[hash.drop(excess)] if excess.positive?
79-
@hash = hash.freeze
78+
@hash = excess.positive? ? Hash[hash.first(MAX_MEMBER_COUNT)] : hash
79+
@hash.freeze
8080
end
8181

8282
# Returns the value associated with the given key, or nil if the key

0 commit comments

Comments
 (0)