Skip to content

Commit 1060b32

Browse files
committed
fix: benchmark format
1 parent d2a35ac commit 1060b32

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

benchmarks/zstd_compress_memory.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
json_string = json_data.to_json
1515

1616
i = 0
17-
17+
start_time = Time.now
1818
while true do
1919
Zstd.compress(json_string)
2020
if ((i % 1000) == 0 )
21-
puts "count:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
21+
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}"
2222
end
2323
i += 1
2424
end

benchmarks/zstd_decompress_memory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
while true do
1717
Zstd.decompress IO.read("./results/#{sample_file_name}.zstd")
1818
if ((i % 1000) == 0 )
19-
puts "count:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
19+
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}"
2020
end
2121
i += 1
2222
end

benchmarks/zstd_streaming_compress_memory.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
json_string = IO.read("./samples/#{sample_file_name}")
1414

1515
i = 0
16+
start_time = Time.now
1617
while true do
1718
stream = Zstd::StreamingCompress.new
1819
stream << json_string[0, 5]
@@ -21,7 +22,7 @@
2122
res << stream.finish
2223
if ((i % 1000) == 0 )
2324
GC.start
24-
puts "count:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
25+
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}"
2526
end
2627
i += 1
2728
end

benchmarks/zstd_streaming_decompress_memory.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

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

2122
if ((i % 1000) == 0 )
2223
GC.start
23-
puts "count:#{i}\truby_memory:#{ObjectSpace.memsize_of_all/1000}\tobject_count:#{ObjectSpace.count_objects}\trss:#{`ps -o rss= -p #{Process.pid}`.to_i}"
24+
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}"
2425
end
2526
i += 1
2627
end

0 commit comments

Comments
 (0)