Skip to content

Commit

Permalink
fix: benchmark format
Browse files Browse the repository at this point in the history
  • Loading branch information
SpringMT committed Apr 11, 2024
1 parent d2a35ac commit 1060b32
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions benchmarks/zstd_compress_memory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
json_string = json_data.to_json

i = 0

start_time = Time.now
while true do
Zstd.compress(json_string)
if ((i % 1000) == 0 )
puts "count:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
puts "sec:#{Time.now - start_time}\tcount:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
end
i += 1
end
2 changes: 1 addition & 1 deletion benchmarks/zstd_decompress_memory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
while true do
Zstd.decompress IO.read("./results/#{sample_file_name}.zstd")
if ((i % 1000) == 0 )
puts "count:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
puts "sec:#{Time.now - start_time}\tcount:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
end
i += 1
end
3 changes: 2 additions & 1 deletion benchmarks/zstd_streaming_compress_memory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
json_string = IO.read("./samples/#{sample_file_name}")

i = 0
start_time = Time.now
while true do
stream = Zstd::StreamingCompress.new
stream << json_string[0, 5]
Expand All @@ -21,7 +22,7 @@
res << stream.finish
if ((i % 1000) == 0 )
GC.start
puts "count:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
puts "sec:#{Time.now - start_time}\tcount:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
end
i += 1
end
3 changes: 2 additions & 1 deletion benchmarks/zstd_streaming_decompress_memory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

cstr = IO.read("./results/#{sample_file_name}.zstd")
i = 0
start_time = Time.now
while true do
stream = Zstd::StreamingDecompress.new
result = ''
Expand All @@ -20,7 +21,7 @@

if ((i % 1000) == 0 )
GC.start
puts "count:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
puts "sec:#{Time.now - start_time}\tcount:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
end
i += 1
end

0 comments on commit 1060b32

Please sign in to comment.