Skip to content

Commit

Permalink
Small file read performance improvement for DirectFileStore
Browse files Browse the repository at this point in the history
Instead of two `read` operations, we can do both together at once

Signed-off-by: Daniel Magliola <danielmagliola@gocardless.com>
  • Loading branch information
Daniel Magliola committed Jun 22, 2020
1 parent 6bb7144 commit 826b32e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/prometheus/client/data_stores/direct_file_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ def all_values
with_file_lock do
@positions.map do |key, pos|
@f.seek(pos)
value = @f.read(8).unpack('d')[0]
timestamp = @f.read(8).unpack('d')[0]
value, timestamp = @f.read(16).unpack('dd')
[key, value, timestamp]
end
end
Expand Down

0 comments on commit 826b32e

Please sign in to comment.